@@ 169-184 (lines=16) @@ | ||
166 | * |
|
167 | * @return LengthAwarePaginator|Collection|Builder |
|
168 | */ |
|
169 | public function all($query = null) |
|
170 | { |
|
171 | $query = $this->modelQuery($query); |
|
172 | ||
173 | $this |
|
174 | ->validateQurey($query) |
|
175 | ->applyWith($query) |
|
176 | ->applySort($query) |
|
177 | ->applyFilters($query); |
|
178 | ||
179 | if ($this->only_query) { |
|
180 | return $query; |
|
181 | } |
|
182 | ||
183 | return $this->execute($query); |
|
184 | } |
|
185 | ||
186 | /** |
|
187 | * Execute query |
|
@@ 261-276 (lines=16) @@ | ||
258 | /** |
|
259 | * @return Model|Builder |
|
260 | */ |
|
261 | public function find($id, $query = null) |
|
262 | { |
|
263 | $query = $this->modelQuery($query); |
|
264 | ||
265 | $this |
|
266 | ->validateQurey($query) |
|
267 | ->applyWith($query); |
|
268 | ||
269 | $query->whereId($id); |
|
270 | ||
271 | if ($this->only_query) { |
|
272 | return $query; |
|
273 | } |
|
274 | ||
275 | return $query->firstOrFail(); |
|
276 | } |
|
277 | ||
278 | public function create(array $data): Model |
|
279 | { |