Skip to content

Commit 815f25c

Browse files
committed
Merge branch '3.x' of github.com:BinarCode/laravel-restify into 3.x
2 parents ace6791 + 2e03c01 commit 815f25c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/Http/Controllers/ProfileController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function __invoke(RestifyRequest $request)
2929
$meta = [];
3030

3131
if (method_exists($user, 'profile')) {
32-
$meta = (array)call_user_func([$user, 'profile'], $request);
32+
$meta = (array) call_user_func([$user, 'profile'], $request);
3333
}
3434

3535
return $this->response()
@@ -41,12 +41,12 @@ public function guessRepository(RestifyRequest $request): ?Repository
4141
{
4242
$repository = $request->repository('users');
4343

44-
if (!$repository) {
44+
if (! $repository) {
4545
return null;
4646
}
4747

4848
if (method_exists($repository, 'canUseForProfile')) {
49-
if (!call_user_func([$repository, 'canUseForProfile'], $request)) {
49+
if (! call_user_func([$repository, 'canUseForProfile'], $request)) {
5050
return null;
5151
}
5252
}

src/Services/Search/RepositorySearchService.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public function prepareMatchFields(RestifyRequest $request, $query, $extra = [])
3131
foreach ($this->repository->getMatchByFields() as $key => $type) {
3232
$negation = false;
3333

34-
if ($request->has('-' . $key)) {
34+
if ($request->has('-'.$key)) {
3535
$negation = true;
3636
}
3737

38-
if (!$request->has($negation ? '-' . $key : $key) && !data_get($extra, "match.$key")) {
38+
if (! $request->has($negation ? '-'.$key : $key) && ! data_get($extra, "match.$key")) {
3939
continue;
4040
}
4141

42-
$match = $request->input($negation ? '-' . $key : $key, data_get($extra, "match.$key"));
42+
$match = $request->input($negation ? '-'.$key : $key, data_get($extra, "match.$key"));
4343

4444
if ($negation) {
4545
$key = Str::after($key, '-');
@@ -76,7 +76,7 @@ public function prepareMatchFields(RestifyRequest $request, $query, $extra = [])
7676
case RestifySearchable::MATCH_INTEGER:
7777
case 'number':
7878
case 'int':
79-
$query->where($field, $negation ? '!=' : '=', (int)$match);
79+
$query->where($field, $negation ? '!=' : '=', (int) $match);
8080
break;
8181
case RestifySearchable::MATCH_DATETIME:
8282
$query->whereDate($field, $negation ? '!=' : '=', $match);
@@ -114,7 +114,7 @@ public function prepareOrders(RestifyRequest $request, $query, $extra = [])
114114
}
115115

116116
if (empty($params) === true) {
117-
$this->setOrder($query, '+' . $this->repository->newModel()->getKeyName());
117+
$this->setOrder($query, '+'.$this->repository->newModel()->getKeyName());
118118
}
119119

120120
return $query;
@@ -158,7 +158,7 @@ public function prepareSearchFields(RestifyRequest $request, $query, $extra = []
158158
$likeOperator = $connectionType == 'pgsql' ? 'ilike' : 'like';
159159

160160
foreach ($this->repository->getSearchableFields() as $column) {
161-
$query->orWhere($model->qualifyColumn($column), $likeOperator, '%' . $search . '%');
161+
$query->orWhere($model->qualifyColumn($column), $likeOperator, '%'.$search.'%');
162162
}
163163
});
164164

@@ -211,12 +211,12 @@ public function setOrder($query, $param)
211211

212212
protected function applyIndexQuery(RestifyRequest $request, Repository $repository)
213213
{
214-
return fn($query) => $repository::indexQuery($request, $query->with($repository::$with));
214+
return fn ($query) => $repository::indexQuery($request, $query->with($repository::$with));
215215
}
216216

217217
protected function applyFilters(RestifyRequest $request, Repository $repository, $query)
218218
{
219-
if (!empty($request->filters)) {
219+
if (! empty($request->filters)) {
220220
$filters = json_decode(base64_decode($request->filters), true);
221221

222222
collect($filters)
@@ -242,7 +242,7 @@ protected function applyFilters(RestifyRequest $request, Repository $repository,
242242
return $matchingFilter;
243243
})
244244
->filter()
245-
->each(fn(Filter $filter) => $filter->filter($request, $query, $filter->value));
245+
->each(fn (Filter $filter) => $filter->filter($request, $query, $filter->value));
246246
}
247247

248248
return $query;

0 commit comments

Comments
 (0)