コード例 #1
0
 public function search($input, $getResults = true)
 {
     $query = User::query();
     $columns = Schema::getColumnListing('users');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     if ($getResults) {
         return [$query->get(), $attributes];
     } else {
         return $query;
     }
 }