Пример #1
0
 /**
  * 显示文章列表
  * @param Request $request
  * @return mixed
  * @author Mr.Cong <*****@*****.**>
  */
 public function lists($name = 'news', $tag = null)
 {
     switch ($name) {
         case 'forums':
             //论坛
             if ($tag != false) {
                 $list = Forums::where('fid', $tag)->paginate(15);
             } else {
                 $list = Forums::paginate(15);
             }
             break;
         case 'news':
             //新闻
             if ($tag != false) {
                 $list = News::where('tag', $tag)->paginate(15);
             } else {
                 $list = News::paginate(15);
             }
             break;
         default:
             break;
     }
     return view('index')->with('list', $list)->with('name', $name);
 }
Пример #2
0
 /**
  * 显示文章列表
  * @param Request $request
  * @return mixed
  * @author Mr.Cong <*****@*****.**>
  */
 public function lists($name, $tag = null)
 {
     switch ($name) {
         case 'forums':
             //论坛
             if ($tag != false) {
                 $list = Forums::where('fid', $tag)->paginate(15);
             } else {
                 $list = Forums::paginate(15);
             }
             break;
         case 'news':
             //新闻
             if ($tag != false) {
                 $list = News::where('tag', $tag)->paginate(15);
             } else {
                 $list = News::paginate(15);
             }
             break;
         default:
             break;
     }
     return Response::json($list);
 }