3939/**
4040 * @property string $type
4141 */
42- class Repository implements RestifySearchable, JsonSerializable
42+ class Repository implements JsonSerializable, RestifySearchable
4343{
44- use InteractWithSearch;
45- use ValidatingTrait;
46- use PerformsQueries;
4744 use ConditionallyLoadsAttributes;
4845 use DelegatesToResource;
49- use ResolvesActions;
50- use ResolvesGetters;
51- use RepositoryEvents;
52- use WithRoutePrefix;
53- use InteractWithFields;
54- use InteractsWithModel;
55- use InteractsWithAttachers;
5646 use HasColumns;
47+ use InteractsWithAttachers;
48+ use InteractsWithModel;
49+ use InteractWithFields;
50+ use InteractWithSearch;
5751 use Mockable;
52+ use PerformsQueries;
53+ use RepositoryEvents;
54+ use ResolvesActions;
55+ use ResolvesGetters;
5856 use Testing;
57+ use ValidatingTrait;
58+ use WithRoutePrefix;
5959
6060 /**
6161 * This is named `resource` because of the forwarding properties from DelegatesToResource trait.
62- *
63- * @var Model
6462 */
6563 public Model $ resource ;
6664
6765 /**
6866 * The list of relations available for the show or index.
6967 *
7068 * e.g. ?related=users
71- *
72- * @var array
7369 */
7470 public static array $ related ;
7571
7672 /**
7773 * The relationships that should be eager loaded when performing an index query.
78- *
79- * @var array
8074 */
8175 public static array $ with = [];
8276
8377 /**
8478 * The list of searchable fields.
85- *
86- * @var array
8779 */
8880 public static array $ search ;
8981
9082 /**
9183 * The list of matchable fields.
92- *
93- * @var array
9484 */
9585 public static array $ match ;
9686
9787 /**
9888 * The list of fields to be sortable.
99- *
100- * @var array
10189 */
10290 public static array $ sort ;
10391
10492 /**
10593 * Attribute that should be used for displaying single model.
106- *
107- * @var string
10894 */
10995 public static string $ title = 'id ' ;
11096
11197 /**
11298 * Attribute that should be used for displaying the `id` in the json:format.
113- *
114- * @var string
11599 */
116100 public static string $ id = 'id ' ;
117101
118102 /**
119103 * Indicates if the repository should be globally searchable.
120- *
121- * @var bool
122104 */
123105 public static bool $ globallySearchable = true ;
124106
125107 /**
126108 * The number of results to display in the global search.
127- *
128- * @var int
129109 */
130110 public static int $ globalSearchResults = 5 ;
131111
@@ -136,52 +116,38 @@ class Repository implements RestifySearchable, JsonSerializable
136116
137117 /**
138118 * The list of middlewares for the current repository.
139- *
140- * @var array
141119 */
142120 public static array $ middleware = [];
143121
144122 /**
145123 * The list of attach callable's.
146- *
147- * @var array
148124 */
149125 public static array $ attachers = [];
150126
151127 /**
152128 * The list of detach callable's.
153- *
154- * @var array
155129 */
156130 public static array $ detachers = [];
157131
158132 /**
159133 * Specify whether the repository could be accessed public.
160- *
161- * @var bool|array
162134 */
163135 public static bool |array $ public = false ;
164136
165137 /**
166138 * Indicates if the repository is serializing for an eager relationship.
167139 *
168140 * The $eagerState will reference to the parent that renders this via related.
169- *
170- * @var null|string
171141 */
172- private null | string $ eagerState = null ;
142+ private ? string $ eagerState = null ;
173143
174144 /**
175145 * Extra fields attached to the repository. Useful when display pivot fields.
176- *
177- * @var array
178146 */
179147 public array $ extraFields = [];
180148
181149 /**
182150 * A collection of pivots for the nested relationships.
183- *
184- * @var PivotsCollection
185151 */
186152 private PivotsCollection $ pivots ;
187153
@@ -194,8 +160,6 @@ public function __construct()
194160
195161 /**
196162 * Get the URI key for the repository.
197- *
198- * @return string
199163 */
200164 public static function uriKey (): string
201165 {
@@ -230,8 +194,6 @@ public static function label()
230194
231195 /**
232196 * Get the value that should be displayed to represent the repository.
233- *
234- * @return string
235197 */
236198 public function title (): string
237199 {
@@ -240,8 +202,6 @@ public function title(): string
240202
241203 /**
242204 * Get the search result subtitle for the repository.
243- *
244- * @return string|null
245205 */
246206 public function subtitle (): ?string
247207 {
@@ -323,9 +283,6 @@ public function withResource($resource): self
323283
324284 /**
325285 * Resolve repository with given model.
326- *
327- * @param Model $model
328- * @return Repository
329286 */
330287 public static function resolveWith (Model $ model ): Repository
331288 {
@@ -351,8 +308,6 @@ public static function __callStatic($method, $parameters)
351308 /**
352309 * Forward calls to the model (getKey() for example).
353310 *
354- * @param $method
355- * @param $parameters
356311 * @return mixed
357312 */
358313 public function __call ($ method , $ parameters )
@@ -369,11 +324,9 @@ public function __call($method, $parameters)
369324 *
370325 * However all options could be customized by passing an $options argument
371326 *
372- * @param Router $router
373- * @param array $attributes
374327 * @param bool $wrap Choose the routes defined in the @routes method, should be wrapped in a group with attributes by default.
375- * If true then all routes will be grouped in a configuration attributes passed by restify, otherwise
376- * you should take care of that, by adding $router->group($attributes) in the @routes method
328+ * If true then all routes will be grouped in a configuration attributes passed by restify, otherwise
329+ * you should take care of that, by adding $router->group($attributes) in the @routes method
377330 */
378331 public static function routes (Router $ router , array $ attributes , $ wrap = true )
379332 {
@@ -388,7 +341,6 @@ public static function routes(Router $router, array $attributes, $wrap = true)
388341 * Resolve all model fields through showCallback methods and exclude from the final response if
389342 * that is required by method
390343 *
391- * @param $request
392344 * @return array
393345 */
394346 public function resolveShowAttributes (RestifyRequest $ request )
@@ -524,7 +476,6 @@ public function resolveIndexPivots(RestifyRequest $request): array
524476 * Return a list with relationship for the current model.
525477 *
526478 * @param RestifyRequest $request
527- * @return array
528479 */
529480 public function resolveRelationships ($ request ): array
530481 {
@@ -550,7 +501,6 @@ public function resolveRelationships($request): array
550501 /**
551502 * Returns the format of the metadata for individual item in the index response.
552503 *
553- * @param $request
554504 * @return array
555505 */
556506 public function resolveIndexMeta ($ request )
@@ -569,7 +519,6 @@ public function resolveIndexMeta($request)
569519 /**
570520 * Return a list with relationship for the current model.
571521 *
572- * @param $request
573522 * @return array
574523 */
575524 public function resolveIndexRelationships ($ request )
@@ -968,7 +917,6 @@ public function allowToDestroy(RestifyRequest $request)
968917 }
969918
970919 /**
971- * @param $request
972920 * @return $this
973921 *
974922 * @throws \Illuminate\Auth\Access\AuthorizationException
@@ -1076,9 +1024,6 @@ private function modelAttributes(Request $request = null): Collection
10761024 /**
10771025 * Fill each field separately.
10781026 *
1079- * @param RestifyRequest $request
1080- * @param Model $model
1081- * @param Collection $fields
10821027 * @return Collection
10831028 */
10841029 protected static function fillFields (RestifyRequest $ request , Model $ model , Collection $ fields )
0 commit comments