/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Notifications::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['NotificationID' => $this->NotificationID, 'PostID' => $this->PostID, 'NotificationFrom' => $this->NotificationFrom, 'TimeStamp' => $this->TimeStamp]); $query->andFilterWhere(['like', 'NotificationContent', $this->NotificationContent])->andFilterWhere(['like', 'NotificationType', $this->NotificationType]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Notifications::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, 'driver_license' => $this->driver_license, 'truck_act' => $this->truck_act, 'truck_period' => $this->truck_period]); return $dataProvider; }
/** * Finds the Notifications model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Notifications the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Notifications::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
protected function adminHeader() { view()->composer('admin.partials.header', function ($view) { $view->with('headerData', ['notifications' => Notifications::where('user_id', Auth::user()->id)->orderBy('created_at', 'desc')->get(), 'messages' => Messages::where('status', 0)->orderBy('created_at', 'desc')->get()]); }); }
public function getNotification($id) { return Notifications::findOrFail($id); }
/** * @return \yii\db\ActiveQuery */ public function getNotifications() { return $this->hasMany(Notifications::className(), ['PostID' => 'PostID']); }
public function CheckNotifications() { $input = Request::all(); $uID = $input['userid']; $iTime = $input['time']; $notif = Notifications::select('*')->where('user_id', $uID)->where('status', 'Unread')->where('Time', '<', $iTime)->get(); echo $notif; }
public function actionIndex() { $query = Notifications::find()->where(['notification_type' => 'all']); $dataProvider = new ActiveDataProvider(['query' => $query]); return $this->render('index', ['dataProvider' => $dataProvider]); }