示例#1
0
 private function my_query(Request $request, array $fields)
 {
     $query = Role::query();
     foreach ($fields as $field) {
         if ($request->has($field)) {
             if ($field == 'id' || $field == 'status') {
                 $query->where($field, '=', trim($request->{$field}));
             } else {
                 $query->where($field, 'like', '%' . trim($request->{$field}) . '%');
             }
         }
     }
     return $query->orderBy('id', 'desc');
 }
示例#2
0
 /**
  * Display a listing of the resource.
  *
  * @author WN
  * @return \Illuminate\View\View
  */
 public function index()
 {
     return $this->standardIndexAction(Role::query(), 'role.index', 'roles');
 }