|
@@ 76-83 (lines=8) @@
|
| 73 |
|
* @param boolean $desc |
| 74 |
|
* @return \Illuminate\Http\Response |
| 75 |
|
*/ |
| 76 |
|
public function search($query = '', $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 77 |
|
{ |
| 78 |
|
if ($this->model) |
| 79 |
|
{ |
| 80 |
|
$relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : []; |
| 81 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->search($query, $perPage, $relations, $sortBy, $desc), 200); |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
/** |
| 86 |
|
* Fetch records from the storage based on the given |
|
@@ 94-101 (lines=8) @@
|
| 91 |
|
* @param boolean $desc |
| 92 |
|
* @return \Illuminate\Http\Response |
| 93 |
|
*/ |
| 94 |
|
public function findby(Request $request, $sortBy = 'created_at', $desc = 1) |
| 95 |
|
{ |
| 96 |
|
if ($this->model) |
| 97 |
|
{ |
| 98 |
|
$relations = $this->relations && $this->relations['findBy'] ? $this->relations['findBy'] : []; |
| 99 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->findBy($request->all(), $relations, $sortBy, $desc), 200); |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
/** |
| 104 |
|
* Fetch the first record from the storage based on the given |
|
@@ 127-134 (lines=8) @@
|
| 124 |
|
* @param boolean $desc |
| 125 |
|
* @return \Illuminate\Http\Response |
| 126 |
|
*/ |
| 127 |
|
public function paginate($perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 128 |
|
{ |
| 129 |
|
if ($this->model) |
| 130 |
|
{ |
| 131 |
|
$relations = $this->relations && $this->relations['paginate'] ? $this->relations['paginate'] : []; |
| 132 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginate($perPage, $relations, $sortBy, $desc), 200); |
| 133 |
|
} |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
/** |
| 137 |
|
* Fetch all records with relations based on |
|
@@ 146-153 (lines=8) @@
|
| 143 |
|
* @param boolean $desc |
| 144 |
|
* @return \Illuminate\Http\Response |
| 145 |
|
*/ |
| 146 |
|
public function paginateby(Request $request, $perPage = 15, $sortBy = 'created_at', $desc = 1) |
| 147 |
|
{ |
| 148 |
|
if ($this->model) |
| 149 |
|
{ |
| 150 |
|
$relations = $this->relations && $this->relations['paginateBy'] ? $this->relations['paginateBy'] : []; |
| 151 |
|
return \Response::json(call_user_func_array("\Core::{$this->model}", [])->paginateBy($request->all(), $perPage, $relations, $sortBy, $desc), 200); |
| 152 |
|
} |
| 153 |
|
} |
| 154 |
|
|
| 155 |
|
/** |
| 156 |
|
* Save the given model to repository. |