| @@ 100-107 (lines=8) @@ | ||
| 97 | * @param boolean $desc |
|
| 98 | * @return \Illuminate\Http\Response |
|
| 99 | */ |
|
| 100 | public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) |
|
| 101 | { |
|
| 102 | if ($this->model) |
|
| 103 | { |
|
| 104 | $relations = $this->relations && $this->relations['search'] ? $this->relations['search'] : []; |
|
| 105 | return \Response::json(call_user_func_array("\Core::{$this->model}", [])->search($query, $perPage, $relations, $sortBy, $desc), 200); |
|
| 106 | } |
|
| 107 | } |
|
| 108 | ||
| 109 | /** |
|
| 110 | * Fetch records from the storage based on the given |
|
| @@ 118-125 (lines=8) @@ | ||
| 115 | * @param boolean $desc |
|
| 116 | * @return \Illuminate\Http\Response |
|
| 117 | */ |
|
| 118 | public function findby(Request $request, $sortBy = 'created_at', $desc = 1) |
|
| 119 | { |
|
| 120 | if ($this->model) |
|
| 121 | { |
|
| 122 | $relations = $this->relations && $this->relations['findBy'] ? $this->relations['findBy'] : []; |
|
| 123 | return \Response::json(call_user_func_array("\Core::{$this->model}", [])->findBy($request->all(), $relations, $sortBy, $desc), 200); |
|
| 124 | } |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * Fetch the first record from the storage based on the given |
|
| @@ 151-158 (lines=8) @@ | ||
| 148 | * @param boolean $desc |
|
| 149 | * @return \Illuminate\Http\Response |
|
| 150 | */ |
|
| 151 | public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) |
|
| 152 | { |
|
| 153 | if ($this->model) |
|
| 154 | { |
|
| 155 | $relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : []; |
|
| 156 | return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginate($perPage, $relations, $sortBy, $desc), 200); |
|
| 157 | } |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * Fetch all records with relations based on |
|
| @@ 170-177 (lines=8) @@ | ||
| 167 | * @param boolean $desc |
|
| 168 | * @return \Illuminate\Http\Response |
|
| 169 | */ |
|
| 170 | public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
|
| 171 | { |
|
| 172 | if ($this->model) |
|
| 173 | { |
|
| 174 | $relations = $this->relations && $this->relations['paginateBy'] ? $this->relations['paginateBy'] : []; |
|
| 175 | return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginateBy($request->all(), $perPage, $relations, $sortBy, $desc), 200); |
|
| 176 | } |
|
| 177 | } |
|
| 178 | ||
| 179 | /** |
|
| 180 | * Save the given model to repository. |
|
| @@ 52-59 (lines=8) @@ | ||
| 49 | * @param boolean $desc |
|
| 50 | * @return \Illuminate\Http\Response |
|
| 51 | */ |
|
| 52 | public function users($groupId, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
|
| 53 | { |
|
| 54 | if ($this->model) |
|
| 55 | { |
|
| 56 | $relations = $this->relations && $this->relations['users'] ? $this->relations['users'] : []; |
|
| 57 | return \Response::json(call_user_func_array("\Core::{$this->model}", [])->users($groupId, $perPage, $relations, $sortBy, $desc), 200); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | } |
|
| 61 | ||