Пример #1
0
 public function index()
 {
     $allFishs = Fish::where('enabled', '=', 1)->orderBy('name_ro')->get();
     if (Request::isMethod('get')) {
         $whereConditions = [];
         if (!empty(Input::all())) {
             foreach (Input::all() as $key => $input) {
                 if (!empty($input) && $key != 'page' && $key != '_token') {
                     $whereConditions[$key] = $input;
                 }
             }
             $fishs = Fish::where($whereConditions)->paginate(30);
         } else {
             $fishs = Fish::orderBy('name_ro')->paginate(30);
         }
     } else {
         $fishs = Fish::orderBy('name_ro')->paginate(30);
     }
     Request::flash();
     return view('admin.fish.index')->with(['fishs' => $fishs, 'allFishs' => $allFishs])->withInput(Input::all());
 }