Skip to content

Commit f812021

Browse files
nikuscsgithub-actions[bot]
authored andcommitted
Fix styling
1 parent cc8a7d6 commit f812021

File tree

4 files changed

+15
-21
lines changed

4 files changed

+15
-21
lines changed

src/Core/Components/Concerns/HasMultipleValues.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ trait HasMultipleValues
88
{
99
protected bool|Closure $isMultiple = false;
1010

11-
1211
public function multiple(Closure|bool $condition = true): static
1312
{
1413
$this->isMultiple = $condition;
14+
1515
return $this;
1616
}
1717

src/Core/Components/Helpers/ResolveRichSelectOptions.php

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ public function __construct(
1515
protected array $columns = [],
1616
protected bool $useScout = true,
1717
protected int $perPage = 10,
18-
)
19-
{}
18+
) {
19+
}
2020

2121
/**
2222
* Builds the query and returns the paginator
23-
*
24-
* @return LengthAwarePaginator
2523
*/
2624
public function response(): LengthAwarePaginator
2725
{
@@ -35,30 +33,30 @@ public function response(): LengthAwarePaginator
3533
$scoutKeys = []; // Stores Laravel scout temporary keys
3634

3735
// If none is filled, return teh latest paginated results
38-
if(!filled($searchQuery) && !filled($values)){
36+
if (! filled($searchQuery) && ! filled($values)) {
3937
return $model::query()->latest()->paginate($this->perPage);
4038
}
4139

42-
if($this->useScout && in_array(Searchable::class, class_uses($model::class))){
40+
if ($this->useScout && in_array(Searchable::class, class_uses($model::class))) {
4341
/** @var Searchable $model */
4442
$scoutKeys = $model::search($searchQuery ?? '')->keys() ?? [];
4543
}
4644

4745
return $model::query()
4846
// If we have values, then we can instantly filter them here
49-
->when(filled($values), function($query) use($model, $values) {
50-
$query->whereIn($model->getKeyName(), !is_array($values) ? Str::of($values)->explode(',') : $values);
47+
->when(filled($values), function ($query) use ($model, $values) {
48+
$query->whereIn($model->getKeyName(), ! is_array($values) ? Str::of($values)->explode(',') : $values);
5149
})
5250
// Not using scout and using regular search
53-
->when(!$this->useScout && filled($searchQuery) && !empty($this->columns), function($query) use($model, $searchQuery, $scoutKeys) {
54-
$query->where(function($query) use($searchQuery, $model, $scoutKeys) {
51+
->when(! $this->useScout && filled($searchQuery) && ! empty($this->columns), function ($query) use ($searchQuery) {
52+
$query->where(function ($query) use ($searchQuery) {
5553
foreach ($this->columns as $column) {
5654
$query->orWhere($column, 'like', "%{$searchQuery}%");
5755
}
5856
});
5957
})
6058
// Using Scout
61-
->when($this->useScout && filled($searchQuery) && !empty($scoutKeys), function($query) use($model, $scoutKeys) {
59+
->when($this->useScout && filled($searchQuery) && ! empty($scoutKeys), function ($query) use ($model, $scoutKeys) {
6260
$query->whereIn($model->getKeyName(), $scoutKeys);
6361
})
6462
// Finally paginate the results
@@ -70,10 +68,6 @@ public function response(): LengthAwarePaginator
7068
* Supporting scout searching
7169
* This function is intended to be used for frontend pooling with Rich Select
7270
*
73-
* @param string $model
74-
* @param array $columns
75-
* @param bool $useScout
76-
* @return LengthAwarePaginator
7771
* @throws \Exception
7872
*/
7973
public static function for(string $model, array $columns = [], bool $useScout = true): LengthAwarePaginator

src/Datatables/Filters/Concerns/HasMultipleValues.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ trait HasMultipleValues
88
{
99
protected bool|Closure $isMultiple = false;
1010

11-
1211
public function multiple(Closure|bool $condition = true): static
1312
{
1413
$this->isMultiple = $condition;
14+
1515
return $this;
1616
}
1717

src/Datatables/Filters/Concerns/InteractsWithTableQuery.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,21 @@ public function apply(Builder $query, string $column, mixed $value): Builder
2727
$method = 'where';
2828
if (is_array($value) || Str::of($value)->contains(',')) {
2929
$method = 'whereIn';
30-
if(is_string($value) && Str::of($value)->contains(',')){
30+
if (is_string($value) && Str::of($value)->contains(',')) {
3131
$value = array_values(array_filter(explode(',', $value)));
3232
}
3333
}
3434

35-
if(is_array($value) && empty($value)){
35+
if (is_array($value) && empty($value)) {
3636
return $query;
3737
}
3838

3939
// Relationships Query
4040
if (Str::of($column)->contains('.')) {
4141
[$relation, $relationshipColumn] = Str::of($column)->explode('.');
4242
if (filled($relation) && filled($relationshipColumn)) {
43-
return $query->whereHas($relation, function(Builder $query) use($value, $relationshipColumn, $method){
44-
return $query->{$method}($relationshipColumn,$value);
43+
return $query->whereHas($relation, function (Builder $query) use ($value, $relationshipColumn, $method) {
44+
return $query->{$method}($relationshipColumn, $value);
4545
});
4646
}
4747
}

0 commit comments

Comments
 (0)