/**
  * Finds the Todolist model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Todolist the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Todolist::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $data = Todolist::find($id);
     return response()->json($data);
 }
Beispiel #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTodolists()
 {
     return $this->hasMany(Todolist::className(), ['user_id' => 'id']);
 }
Beispiel #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getList()
 {
     return $this->hasOne(Todolist::className(), ['id' => 'list_id']);
 }