当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::findOne方法代码示例

本文整理汇总了PHP中app\models\Client::findOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::findOne方法的具体用法?PHP Client::findOne怎么用?PHP Client::findOne使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Client的用法示例。


在下文中一共展示了Client::findOne方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: findModel

 /**
  * Finds the Client model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Client the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Client::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:Sywooch,项目名称:arenda,代码行数:15,代码来源:ClientController.php

示例2: actionSendmail

 /**
  * send a email to client with checklist attached
  * @return void
  */
 public function actionSendmail()
 {
     $post = Yii::$app->request->post('SendmailForm');
     Yii::$app->response->format = 'json';
     $sm_form = new SendmailForm();
     if ($sm_form->load(Yii::$app->request->post()) && $sm_form->validate()) {
         $checklistCow = ChecklistsCow::findOne($post['checklists_cow_id']);
         if ($checklistCow->belong_to == 1) {
             $cow = Client::findOne($checklistCow->clients_or_webs_id);
             $email = $cow->email;
         } elseif ($checklistCow->belong_to == 2) {
             $cow = Website::findOne($checklistCow->clients_or_webs_id);
             $email = $cow->client->email;
         }
         // save time sending
         // checking if time sending is exist then only update else create new one
         $timeSent = ChecklistsTimeSent::find()->where(['checklists_cow_id' => $post['checklists_cow_id']])->one();
         if (!isset($timeSent)) {
             $timeSent = new ChecklistsTimeSent();
         }
         $timeSent->checklists_cow_id = $post['checklists_cow_id'];
         $timeSent->time_sent = date('Y-m-d H:i:s');
         $timeSent->save();
         // if everything is ok, then send mail. go ahead!!!
         Yii::$app->mailer->compose()->setFrom('admin@panel.com')->setTo($email)->setSubject($post['subject'])->setTextBody($post['content'])->attach(Yii::$app->basePath . '/web/upload/pdf/' . $checklistCow->file_name)->send();
         return ['errors' => ''];
     } else {
         return ['errors' => 'Something is wrong.'];
     }
 }
开发者ID:hoangngk,项目名称:adminpanel,代码行数:34,代码来源:ChecklistsController.php

示例3: testTenTodayOrders

 public function testTenTodayOrders()
 {
     $this->assertEquals(10, count(Client::findOne(101)->getTenTodayOrders()->all()));
 }
开发者ID:mvcaaa,项目名称:TestCase013,代码行数:4,代码来源:ClientTest.php

示例4: actionDelete

 /**
  * Deletes an existing Client model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = Client::findOne($id);
     Order::deleteAll(['id_client' => $model->id]);
     $model->delete();
     return $this->redirect(['index']);
 }
开发者ID:earlcherry,项目名称:test-project,代码行数:13,代码来源:OrderController.php


注:本文中的app\models\Client::findOne方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。