|
@@ 96-103 (lines=8) @@
|
| 93 |
|
* @param boolean $desc |
| 94 |
|
* @return \Illuminate\Http\Response |
| 95 |
|
*/ |
| 96 |
|
public function getSearch($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 97 |
|
{ |
| 98 |
|
if ($this->model) |
| 99 |
|
{ |
| 100 |
|
$relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : []; |
| 101 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->search($query, $perPage, $relations, $sortBy, $desc), 200); |
| 102 |
|
} |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
/** |
| 106 |
|
* Fetch records from the storage based on the given |
|
@@ 114-121 (lines=8) @@
|
| 111 |
|
* @param boolean $desc |
| 112 |
|
* @return \Illuminate\Http\Response |
| 113 |
|
*/ |
| 114 |
|
public function postFindby(Request $request, $sortBy = 'created_at', $desc = 1) |
| 115 |
|
{ |
| 116 |
|
if ($this->model) |
| 117 |
|
{ |
| 118 |
|
$relations = $this->relations && $this->relations['findBy'] ? $this->relations['findBy'] : []; |
| 119 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->findBy($request->all(), $relations, $sortBy, $desc), 200); |
| 120 |
|
} |
| 121 |
|
} |
| 122 |
|
|
| 123 |
|
/** |
| 124 |
|
* Fetch the first record from the storage based on the given |
|
@@ 147-154 (lines=8) @@
|
| 144 |
|
* @param boolean $desc |
| 145 |
|
* @return \Illuminate\Http\Response |
| 146 |
|
*/ |
| 147 |
|
public function getPaginate($perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 148 |
|
{ |
| 149 |
|
if ($this->model) |
| 150 |
|
{ |
| 151 |
|
$relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : []; |
| 152 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginate($perPage, $relations, $sortBy, $desc), 200); |
| 153 |
|
} |
| 154 |
|
} |
| 155 |
|
|
| 156 |
|
/** |
| 157 |
|
* Fetch all records with relations based on |
|
@@ 166-173 (lines=8) @@
|
| 163 |
|
* @param boolean $desc |
| 164 |
|
* @return \Illuminate\Http\Response |
| 165 |
|
*/ |
| 166 |
|
public function postPaginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 167 |
|
{ |
| 168 |
|
if ($this->model) |
| 169 |
|
{ |
| 170 |
|
$relations = $this->relations && $this->relations['paginateBy'] ? $this->relations['paginateBy'] : []; |
| 171 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginateBy($request->all(), $perPage, $relations, $sortBy, $desc), 200); |
| 172 |
|
} |
| 173 |
|
} |
| 174 |
|
|
| 175 |
|
/** |
| 176 |
|
* Save the given model to repository. |