diff --git a/src/Http/Controllers/ProfileController.php b/src/Http/Controllers/ProfileController.php index b0153cd51..8d64a38f0 100644 --- a/src/Http/Controllers/ProfileController.php +++ b/src/Http/Controllers/ProfileController.php @@ -29,7 +29,7 @@ public function __invoke(RestifyRequest $request) $meta = []; if (method_exists($user, 'profile')) { - $meta = (array)call_user_func([$user, 'profile'], $request); + $meta = (array) call_user_func([$user, 'profile'], $request); } return $this->response() @@ -41,12 +41,12 @@ public function guessRepository(RestifyRequest $request): ?Repository { $repository = $request->repository('users'); - if (!$repository) { + if (! $repository) { return null; } if (method_exists($repository, 'canUseForProfile')) { - if (!call_user_func([$repository, 'canUseForProfile'], $request)) { + if (! call_user_func([$repository, 'canUseForProfile'], $request)) { return null; } } diff --git a/src/Services/Search/RepositorySearchService.php b/src/Services/Search/RepositorySearchService.php index b42991cf7..c5beaec9b 100644 --- a/src/Services/Search/RepositorySearchService.php +++ b/src/Services/Search/RepositorySearchService.php @@ -31,15 +31,15 @@ public function prepareMatchFields(RestifyRequest $request, $query, $extra = []) foreach ($this->repository->getMatchByFields() as $key => $type) { $negation = false; - if ($request->has('-' . $key)) { + if ($request->has('-'.$key)) { $negation = true; } - if (!$request->has($negation ? '-' . $key : $key) && !data_get($extra, "match.$key")) { + if (! $request->has($negation ? '-'.$key : $key) && ! data_get($extra, "match.$key")) { continue; } - $match = $request->input($negation ? '-' . $key : $key, data_get($extra, "match.$key")); + $match = $request->input($negation ? '-'.$key : $key, data_get($extra, "match.$key")); if ($negation) { $key = Str::after($key, '-'); @@ -76,7 +76,7 @@ public function prepareMatchFields(RestifyRequest $request, $query, $extra = []) case RestifySearchable::MATCH_INTEGER: case 'number': case 'int': - $query->where($field, $negation ? '!=' : '=', (int)$match); + $query->where($field, $negation ? '!=' : '=', (int) $match); break; case RestifySearchable::MATCH_DATETIME: $query->whereDate($field, $negation ? '!=' : '=', $match); @@ -114,7 +114,7 @@ public function prepareOrders(RestifyRequest $request, $query, $extra = []) } if (empty($params) === true) { - $this->setOrder($query, '+' . $this->repository->newModel()->getKeyName()); + $this->setOrder($query, '+'.$this->repository->newModel()->getKeyName()); } return $query; @@ -158,7 +158,7 @@ public function prepareSearchFields(RestifyRequest $request, $query, $extra = [] $likeOperator = $connectionType == 'pgsql' ? 'ilike' : 'like'; foreach ($this->repository->getSearchableFields() as $column) { - $query->orWhere($model->qualifyColumn($column), $likeOperator, '%' . $search . '%'); + $query->orWhere($model->qualifyColumn($column), $likeOperator, '%'.$search.'%'); } }); @@ -211,12 +211,12 @@ public function setOrder($query, $param) protected function applyIndexQuery(RestifyRequest $request, Repository $repository) { - return fn($query) => $repository::indexQuery($request, $query->with($repository::$with)); + return fn ($query) => $repository::indexQuery($request, $query->with($repository::$with)); } protected function applyFilters(RestifyRequest $request, Repository $repository, $query) { - if (!empty($request->filters)) { + if (! empty($request->filters)) { $filters = json_decode(base64_decode($request->filters), true); collect($filters) @@ -242,7 +242,7 @@ protected function applyFilters(RestifyRequest $request, Repository $repository, return $matchingFilter; }) ->filter() - ->each(fn(Filter $filter) => $filter->filter($request, $query, $filter->value)); + ->each(fn (Filter $filter) => $filter->filter($request, $query, $filter->value)); } return $query;