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


PHP Event::find方法代码示例

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


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

示例1: actionIndex

 public function actionIndex()
 {
     $query = Event::find();
     $pagination = new Pagination(['defaultPageSize' => 5, 'totalCount' => $query->count()]);
     $events = $query->orderBy('date')->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('index', ['events' => $events, 'pagination' => $pagination]);
 }
开发者ID:mts7,项目名称:framework-compare,代码行数:7,代码来源:EventController.php

示例2: actionOtchet

 public function actionOtchet()
 {
     $this->layout = false;
     $poisk1 = Yii::$app->request->post('from_date');
     $poisk2 = Yii::$app->request->post('to_date');
     return $this->render('otchet', ['model' => Event::find()->where(['between', 'date_event', $poisk1, $poisk2])->orderBy('date_event, time_event')->all(), 'poisk1' => $poisk1, 'poisk2' => $poisk2]);
 }
开发者ID:Sywooch,项目名称:arenda,代码行数:7,代码来源:EventController.php

示例3: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     if (\Yii::$app->user->isGuest) {
         return null;
     }
     $user = \Yii::$app->user->identity;
     if (!$user->admin && count($user->organisations) == 0) {
         return null;
     } else {
         if (!$user->admin) {
             $organisations = $user->organisations;
             foreach ($organisations as $organisation) {
                 $query->orWhere(['owner_id' => $organisation->id]);
             }
         }
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'owner_id' => $this->owner_id, 'start_time' => $this->start_time, 'end_time' => $this->end_time]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'summary', $this->summary]);
     return $dataProvider;
 }
开发者ID:yodathedark,项目名称:moltis-tickets,代码行数:35,代码来源:EventSearch.php

示例4: actionIndex

 /**
  * Lists all Event models.
  * @return mixed
  */
 public function actionIndex($id = null)
 {
     //Check user level & existence of $id
     $id = Yii::$app->user->identity->level == 0 && $id != null ? $id : Yii::$app->user->id;
     //$searchModel = new EventSearch();
     //$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['events' => Event::find()->where('FIND_IN_SET(' . $id . ', shared_with)')->orWhere('user_id=' . $id)->all()]);
 }
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:12,代码来源:EventController.php

示例5: actionEvents_item

 /**
  * Выводит событие
  *
  * @param int $id идентификатор события
  *
  * @return string
  * @throws \cs\web\Exception
  */
 public function actionEvents_item($id)
 {
     $item = Event::find($id);
     if (is_null($item)) {
         throw new Exception('Событие не найдено');
     }
     return $this->render(['item' => $item]);
 }
开发者ID:Makeyko,项目名称:galaxysss,代码行数:16,代码来源:CalendarController.php

示例6: getRoom

 public function getRoom($eventId)
 {
     $event = Event::find($eventId);
     $room = $event->room;
     if (!$room) {
         return $this->respondNotFound('Room Not Found!');
     }
     return $this->respond([$room->toArray()]);
 }
开发者ID:rob-meh,项目名称:table-seater,代码行数:9,代码来源:EventController.php

示例7: eventPost

 public function eventPost($id)
 {
     //
     $event = Event::find($id);
     $posts = $event->posts;
     $response = new \stdClass();
     $response->success = true;
     $response->total = count($posts);
     $response->data = $posts;
     return response()->json($response);
 }
开发者ID:HenOltma,项目名称:EventMap,代码行数:11,代码来源:PostRESTController.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //dd(Input::get('data'));
     $data = Input::get('data');
     foreach ($data as $key => $value) {
         if (Event::find($value['id']) != null) {
             Event::find($value['id'])->update(['title' => $value['title'], 'start' => $value['start'], 'end' => $value['end']]);
         } else {
             Event::create(array('title' => $value['title'], 'start' => $value['start'], 'end' => $value['end']));
         }
     }
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:17,代码来源:EventController.php

示例9: actionIndex

 /**
  * Lists all Event models.
  * @return mixed
  */
 public function actionIndex()
 {
     $events = Event::find()->all();
     $tasks = [];
     foreach ($events as $eve) {
         $event = new \yii2fullcalendar\models\event();
         $event->id = $eve->id;
         $event->title = $eve->title;
         $event->start = $eve->created_date;
         $tasks[] = $event;
     }
     return $this->render('index', ['events' => $tasks]);
 }
开发者ID:filimonchuk93,项目名称:monitoring.my,代码行数:17,代码来源:EventController.php

示例10: actionSubscribe

 /**
  * AJAX
  * Добавляет site_update
  * Делает рассылку
  *
  * @param integer $id - идентификатор события
  *
  * @return string
  */
 public function actionSubscribe($id)
 {
     $item = \app\models\Event::find($id);
     if (is_null($item)) {
         return self::jsonError(101, 'Не найдено событие');
     }
     $start = microtime(true);
     Subscribe::add($item);
     SiteUpdate::add($item);
     $item->update(['is_added_site_update' => 1]);
     \Yii::info(microtime(true) - $start, 'gs\\actionSubscribe');
     return self::jsonSuccess();
 }
开发者ID:Makeyko,项目名称:galaxysss,代码行数:22,代码来源:Admin_eventsController.php

示例11: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_date' => $this->created_date]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
开发者ID:filimonchuk93,项目名称:monitoring.my,代码行数:21,代码来源:EventSearch.php

示例12: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'start' => $this->start, 'finish' => $this->finish, 'is_allday' => $this->is_allday, 'created' => $this->created]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'roomid', $this->roomid])->andFilterWhere(['like', 'note', $this->note]);
     return $dataProvider;
 }
开发者ID:kaweesak,项目名称:arit_training,代码行数:21,代码来源:EventSearch.php

示例13: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Event::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'start' => $this->start, 'end' => $this->end, 'active' => $this->active]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
开发者ID:Flashpoint-Artists-Initiative,项目名称:Volunteering,代码行数:21,代码来源:EventSearch.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request, $eventId)
 {
     $input = Input::except('token');
     $roomId = Event::find($eventId)->room->id;
     $tableType = $table = new Table();
     $validator = $table->getValidator($input);
     if ($validator->fails()) {
         return $this->respondInvalidData($validator->errors());
     }
     $table->fill($input);
     $table->room_id = $roomId;
     $table->save();
     return $this->respondCreateSuccess('Table: ' . $table->table_name . ' created');
 }
开发者ID:rob-meh,项目名称:table-seater,代码行数:20,代码来源:TableController.php

示例15: validateTime1

 public function validateTime1($attribute)
 {
     if (!$this->hasErrors()) {
         if ($this->isNewRecord) {
             $timeprov = Event::find()->where(['date_event' => $this->date_event, 'id_zal' => $this->id_zal])->all();
             foreach ($timeprov as $timeprovdet) {
                 $t = explode(' - ', $timeprovdet->time_event);
                 if ($this->time_c >= $t[0] and $this->time_c <= $t[1]) {
                     $this->addError($attribute, 'В это время зал занят');
                 }
             }
         }
     }
 }
开发者ID:Sywooch,项目名称:arenda,代码行数:14,代码来源:Event.php


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