コード例 #1
0
 /**
  * Lists all Links models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Links::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
コード例 #2
0
ファイル: LinksController.php プロジェクト: xinzou/blog
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $data = $request->all();
     unset($data['_token']);
     try {
         Links::find($id)->update($data);
         return redirect()->action('Admin\\LinksController@index')->with(array('dialog' => array('title' => '修改友情链接成功', 'message' => $data)));
     } catch (\Exception $e) {
         return redirect()->back()->withErrors(['error' => '修改友情链接失败, 请重试'])->with($data);
     }
 }