@@ 156-171 (lines=16) @@ | ||
153 | * |
|
154 | * @return LengthAwarePaginator|Collection|Builder |
|
155 | */ |
|
156 | public function all($query = null) |
|
157 | { |
|
158 | $query = $this->modelQuery($query); |
|
159 | ||
160 | $this |
|
161 | ->validateQurey($query) |
|
162 | ->applyWith($query) |
|
163 | ->applySort($query) |
|
164 | ->applyFilters($query); |
|
165 | ||
166 | if ($this->only_query) { |
|
167 | return $query; |
|
168 | } |
|
169 | ||
170 | return $this->execute($query); |
|
171 | } |
|
172 | ||
173 | /** |
|
174 | * Execute query |
|
@@ 248-263 (lines=16) @@ | ||
245 | /** |
|
246 | * @return Model|Builder |
|
247 | */ |
|
248 | public function find($id, $query = null) |
|
249 | { |
|
250 | $query = $this->modelQuery($query); |
|
251 | ||
252 | $this |
|
253 | ->validateQurey($query) |
|
254 | ->applyWith($query); |
|
255 | ||
256 | $query->whereId($id); |
|
257 | ||
258 | if ($this->only_query) { |
|
259 | return $query; |
|
260 | } |
|
261 | ||
262 | return $query->firstOrFail(); |
|
263 | } |
|
264 | ||
265 | public function create(array $data): Model |
|
266 | { |