@@ -67,14 +67,14 @@ public function makeModel(): Model
6767 return $ this ->model = $ model ;
6868 }
6969
70- public function scopeQuery (\ Closure $ scope ): BaseRepository
70+ public function scopeQuery (Closure $ scope ): BaseRepository
7171 {
7272 return tap ($ this , function () use ($ scope ) {
7373 $ this ->scopeQuery = $ scope ;
7474 });
7575 }
7676
77- public function pluck ($ column , $ key = null )
77+ public function pluck ($ column , $ key = null ): Collection
7878 {
7979 return $ this ->model ->pluck ($ column , $ key );
8080 }
@@ -89,7 +89,7 @@ public function syncWithoutDetaching($id, $relation, $attributes)
8989 return $ this ->sync ($ id , $ relation , $ attributes , false );
9090 }
9191
92- public function all ($ columns = ['* ' ])
92+ public function all ($ columns = ['* ' ]): Collection | array
9393 {
9494 $ this ->applyScope ();
9595
@@ -101,7 +101,7 @@ public function all($columns = ['*'])
101101 return $ results ;
102102 }
103103
104- public function count (array $ where = [], $ columns = '* ' )
104+ public function count (array $ where = [], $ columns = '* ' ): int
105105 {
106106 $ this ->applyScope ();
107107
@@ -115,12 +115,12 @@ public function count(array $where = [], $columns = '*')
115115 return $ result ;
116116 }
117117
118- public function get ($ columns = ['* ' ]): array | Collection
118+ public function get ($ columns = ['* ' ]): Collection | array
119119 {
120120 return $ this ->all ($ columns );
121121 }
122122
123- public function first ($ columns = ['* ' ])
123+ public function first ($ columns = ['* ' ]): Model | Builder
124124 {
125125 $ this ->applyScope ();
126126
@@ -131,7 +131,7 @@ public function first($columns = ['*'])
131131 return $ result ;
132132 }
133133
134- public function firstOrNew (array $ attributes = [])
134+ public function firstOrNew (array $ attributes = []): Model | Builder
135135 {
136136 $ this ->applyScope ();
137137
@@ -142,7 +142,7 @@ public function firstOrNew(array $attributes = [])
142142 return $ model ;
143143 }
144144
145- public function firstOrCreate (array $ attributes = [])
145+ public function firstOrCreate (array $ attributes = []): Model | Builder
146146 {
147147 $ this ->applyScope ();
148148
@@ -159,7 +159,7 @@ public function limit($limit, $columns = ['*']): array|Collection
159159 return $ this ->all ($ columns );
160160 }
161161
162- public function paginate ($ limit = null , $ columns = ['* ' ], $ method = "paginate " )
162+ public function paginate ($ limit = null , $ columns = ['* ' ], $ method = "paginate " ): mixed
163163 {
164164 $ this ->applyScope ();
165165
@@ -179,7 +179,7 @@ public function simplePaginate($limit = null, $columns = ['*'])
179179 return $ this ->paginate ($ limit , $ columns , "simplePaginate " );
180180 }
181181
182- public function find (int $ id , $ columns = ['* ' ])
182+ public function find (int $ id , $ columns = ['* ' ]): Model | Builder
183183 {
184184 $ this ->applyScope ();
185185 $ model = $ this ->model ->findOrFail ($ id , $ columns );
@@ -188,7 +188,7 @@ public function find(int $id, $columns = ['*'])
188188 return $ model ;
189189 }
190190
191- public function findByField (string $ field , $ value = null , $ columns = ['* ' ])
191+ public function findByField (string $ field , $ value = null , $ columns = ['* ' ]): Collection | array
192192 {
193193 $ this ->applyScope ();
194194 $ model = $ this ->model ->where ($ field , '= ' , $ value )->get ($ columns );
@@ -197,7 +197,7 @@ public function findByField(string $field, $value = null, $columns = ['*'])
197197 return $ model ;
198198 }
199199
200- public function findWhere (array $ where , $ columns = ['* ' ])
200+ public function findWhere (array $ where , $ columns = ['* ' ]): Collection | array
201201 {
202202 $ this ->applyScope ();
203203 $ this ->applyConditions ($ where );
@@ -207,7 +207,7 @@ public function findWhere(array $where, $columns = ['*'])
207207 return $ model ;
208208 }
209209
210- public function findWhereIn ($ field , array $ values , $ columns = ['* ' ])
210+ public function findWhereIn ($ field , array $ values , $ columns = ['* ' ]): Collection | array
211211 {
212212 $ this ->applyScope ();
213213 $ model = $ this ->model ->whereIn ($ field , $ values )->get ($ columns );
@@ -216,7 +216,7 @@ public function findWhereIn($field, array $values, $columns = ['*'])
216216 return $ model ;
217217 }
218218
219- public function findWhereNotIn ($ field , array $ values , $ columns = ['* ' ])
219+ public function findWhereNotIn ($ field , array $ values , $ columns = ['* ' ]): Collection | array
220220 {
221221 $ this ->applyScope ();
222222 $ model = $ this ->model ->whereNotIn ($ field , $ values )->get ($ columns );
@@ -225,7 +225,7 @@ public function findWhereNotIn($field, array $values, $columns = ['*'])
225225 return $ model ;
226226 }
227227
228- public function findWhereBetween ($ field , array $ values , $ columns = ['* ' ])
228+ public function findWhereBetween ($ field , array $ values , $ columns = ['* ' ]): Collection | array
229229 {
230230 $ this ->applyScope ();
231231 $ model = $ this ->model ->whereBetween ($ field , $ values )->get ($ columns );
@@ -245,7 +245,7 @@ public function create(array $attributes): Model
245245 return $ model ;
246246 }
247247
248- public function update (array $ attributes , $ id )
248+ public function update (array $ attributes , int $ id ): Model
249249 {
250250 $ this ->applyScope ();
251251
@@ -258,7 +258,7 @@ public function update(array $attributes, $id)
258258 return $ model ;
259259 }
260260
261- public function updateOrCreate (array $ attributes , array $ values = [])
261+ public function updateOrCreate (array $ attributes , array $ values = []): Model | Builder
262262 {
263263 $ this ->applyScope ();
264264
@@ -334,7 +334,7 @@ public function hidden(array $fields): BaseRepository
334334 });
335335 }
336336
337- public function visible (array $ fields )
337+ public function visible (array $ fields ): BaseRepository
338338 {
339339 return tap ($ this , function () use ($ fields ) {
340340 $ this ->model ->setVisible ($ fields );
0 commit comments