@@ -67,29 +67,22 @@ public function makeModel(): Model
6767 return $ this ->model = $ model ;
6868 }
6969
70- public function scopeQuery (Closure $ scope ): BaseRepository
71- {
72- return tap ($ this , function () use ($ scope ) {
73- $ this ->scopeQuery = $ scope ;
74- });
75- }
76-
77- public function pluck ($ column , $ key = null ): Collection
70+ public function pluck ($ column , $ key = null ): Collection |array
7871 {
7972 return $ this ->model ->pluck ($ column , $ key );
8073 }
8174
82- public function sync ($ id , $ relation , $ attributes , $ detaching = true )
75+ public function sync ($ id , $ relation , $ attributes , $ detaching = true ): mixed
8376 {
8477 return $ this ->find ($ id )->{$ relation }()->sync ($ attributes , $ detaching );
8578 }
8679
87- public function syncWithoutDetaching ($ id , $ relation , $ attributes )
80+ public function syncWithoutDetaching ($ id , $ relation , $ attributes ): mixed
8881 {
8982 return $ this ->sync ($ id , $ relation , $ attributes , false );
9083 }
9184
92- public function all ($ columns = ['* ' ]): Collection | array
85+ public function all ($ columns = ['* ' ]): mixed
9386 {
9487 $ this ->applyScope ();
9588
@@ -115,7 +108,7 @@ public function count(array $where = [], $columns = '*'): int
115108 return $ result ;
116109 }
117110
118- public function get ($ columns = ['* ' ]): Collection | array
111+ public function get ($ columns = ['* ' ]): mixed
119112 {
120113 return $ this ->all ($ columns );
121114 }
@@ -153,7 +146,7 @@ public function firstOrCreate(array $attributes = []): Model|Builder
153146 return $ model ;
154147 }
155148
156- public function limit ($ limit , $ columns = ['* ' ]): array | Collection
149+ public function limit ($ limit , $ columns = ['* ' ]): mixed
157150 {
158151 $ this ->take ($ limit );
159152 return $ this ->all ($ columns );
@@ -174,7 +167,7 @@ public function paginate($limit = null, $columns = ['*'], $method = "paginate"):
174167 return $ results ;
175168 }
176169
177- public function simplePaginate ($ limit = null , $ columns = ['* ' ])
170+ public function simplePaginate ($ limit = null , $ columns = ['* ' ]): mixed
178171 {
179172 return $ this ->paginate ($ limit , $ columns , "simplePaginate " );
180173 }
@@ -299,70 +292,77 @@ public function restore(int $id): Model
299292 return $ this ->manageDeletes ($ id , 'restore ' );
300293 }
301294
302- public function has ($ relation ): BaseRepository
295+ public function has ($ relation ): static
303296 {
304297 return tap ($ this , function () use ($ relation ) {
305298 $ this ->model = $ this ->model ->has ($ relation );
306299 });
307300 }
308301
309- public function with ($ relations ): BaseRepository
302+ public function with ($ relations ): static
310303 {
311304 return tap ($ this , function () use ($ relations ) {
312305 $ this ->model = $ this ->model ->with ($ relations );
313306 });
314307 }
315308
316- public function withCount ($ relations ): BaseRepository
309+ public function withCount ($ relations ): static
317310 {
318311 return tap ($ this , function () use ($ relations ) {
319312 $ this ->model = $ this ->model ->withCount ($ relations );
320313 });
321314 }
322315
323- public function whereHas (string $ relation , Closure $ closure ): BaseRepository
316+ public function whereHas (string $ relation , Closure $ closure ): static
324317 {
325318 return tap ($ this , function () use ($ relation , $ closure ) {
326319 $ this ->model = $ this ->model ->whereHas ($ relation , $ closure );
327320 });
328321 }
329322
330- public function hidden (array $ fields ): BaseRepository
323+ public function hidden (array $ fields ): static
331324 {
332325 return tap ($ this , function () use ($ fields ) {
333326 $ this ->model ->setHidden ($ fields );
334327 });
335328 }
336329
337- public function visible (array $ fields ): BaseRepository
330+ public function visible (array $ fields ): static
338331 {
339332 return tap ($ this , function () use ($ fields ) {
340333 $ this ->model ->setVisible ($ fields );
341334 });
342335 }
343336
344- public function orderBy ($ column , $ direction = 'asc ' ): BaseRepository
337+ public function orderBy ($ column , $ direction = 'asc ' ): static
345338 {
346339 return tap ($ this , function () use ($ column , $ direction ) {
347340 $ this ->model = $ this ->model ->orderBy ($ column , $ direction );
348341 });
349342 }
350343
351- public function take ($ limit ): BaseRepository
344+ public function take ($ limit ): static
352345 {
353346 return tap ($ this , function () use ($ limit ) {
354347 $ this ->model = $ this ->model ->limit ($ limit );
355348 });
356349 }
357350
358- public function resetScope (): BaseRepository
351+ public function scopeQuery (Closure $ scope ): static
352+ {
353+ return tap ($ this , function () use ($ scope ) {
354+ $ this ->scopeQuery = $ scope ;
355+ });
356+ }
357+
358+ public function resetScope (): static
359359 {
360360 return tap ($ this , function () {
361361 $ this ->scopeQuery = null ;
362362 });
363363 }
364364
365- public function applyScope (): BaseRepository
365+ public function applyScope (): static
366366 {
367367 return tap ($ this , function () {
368368 if (isset ($ this ->scopeQuery ) && is_callable ($ this ->scopeQuery )) {
0 commit comments