コード例 #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy(Request $request)
 {
     DB::connection()->getPdo()->beginTransaction();
     try {
         foreach ($request->request->get("picIdList") as $id) {
             $mainHorizontalPics = MainHorizontalPics::find($id);
             $mainHorizontalPics->delete();
         }
         DB::connection()->getPdo()->commit();
         return response()->json(array("ok" => 1), 200, ['Content-Type:text/json;charset=UTF-8']);
     } catch (\PDOException $e) {
         DB::connection()->getPdo()->rollback();
     }
 }
コード例 #2
0
ファイル: IndexController.php プロジェクト: ryandong82/zhsite
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     //return 'hello';
     //$article = Article::all();
     //return $article;
     //return ArticleCategory::find(1)->getForeignKey();
     $article_categories = ArticleCategory::query()->orderBy("ord_no")->get();
     //return $articles;
     $horzPics = MainHorizontalPics::all();
     $articles = Article::topN(15);
     //        foreach ($articles as $article) {
     //            $article["file"] = MyUtil::get_res_file($article->content);
     //        }
     ///return $article;
     return response()->view('site.index', array('categories' => $article_categories, 'articles' => $articles, 'horzPics' => $horzPics));
 }