Skip to content

Commit ea305d9

Browse files
committed
style
1 parent f44ef9d commit ea305d9

37 files changed

+100
-100
lines changed

src/Actions/Action.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ protected function resolveField(Request $request, Field $field): void
134134
{
135135
$field->setAttribute('form', $this->getKey());
136136
$field->id($this->getKey().'-'.$field->getAttribute('id'));
137-
$field->resolveErrorsUsing(fn(Request $request): MessageBag => $this->errors($request));
137+
$field->resolveErrorsUsing(fn (Request $request): MessageBag => $this->errors($request));
138138

139139
if ($field instanceof Relation) {
140-
$field->resolveRouteKeyNameUsing(fn(): string => Str::of($field->getRelationName())->singular()->ucfirst()->prepend($this->getKey())->value());
140+
$field->resolveRouteKeyNameUsing(fn (): string => Str::of($field->getRelationName())->singular()->ucfirst()->prepend($this->getKey())->value());
141141
}
142142
}
143143

src/Actions/Actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function visible(string|array $context): static
4444
*/
4545
public function standalone(bool $value = true): static
4646
{
47-
return $this->filter(static fn(Action $action): bool => $value ? $action->isStandalone() : ! $action->isStandalone());
47+
return $this->filter(static fn (Action $action): bool => $value ? $action->isStandalone() : ! $action->isStandalone());
4848
}
4949

5050
/**

src/Actions/SendVerificationNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class SendVerificationNotification extends Action
1313
*/
1414
public function handle(Request $request, Collection $models): void
1515
{
16-
$models->reject(static fn(User $user): bool => $user->hasVerifiedEmail())->each(static function (User $user): void {
16+
$models->reject(static fn (User $user): bool => $user->hasVerifiedEmail())->each(static function (User $user): void {
1717
$user->sendEmailVerificationNotification();
1818
});
1919
}

src/Fields/BelongsToMany.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,21 @@ public function getRelation(Model $model): EloquentRelation
6767
public function fields(Request $request): array
6868
{
6969
return [
70-
BelongsTo::make($this->getRelatedName(), 'related', static fn(Pivot $model): BelongsToRelation => $model->belongsTo(
70+
BelongsTo::make($this->getRelatedName(), 'related', static fn (Pivot $model): BelongsToRelation => $model->belongsTo(
7171
$model->getRelation('related')::class,
7272
$model->getRelatedKey(),
7373
$model->getForeignKey(),
7474
'related'
75-
)->withDefault())->withRelatableQuery(fn(Request $request, Builder $query, Pivot $model): Builder => $this->resolveRelatableQuery($request, $model->pivotParent)
76-
->unless($this->allowDuplicateRelations, fn(Builder $query): Builder => $query->whereNotIn(
75+
)->withDefault())->withRelatableQuery(fn (Request $request, Builder $query, Pivot $model): Builder => $this->resolveRelatableQuery($request, $model->pivotParent)
76+
->unless($this->allowDuplicateRelations, fn (Builder $query): Builder => $query->whereNotIn(
7777
$query->getModel()->getQualifiedKeyName(),
7878
$this->getRelation($model->pivotParent)->select($query->getModel()->getQualifiedKeyName())
7979
)))->hydrate(function (Request $request, Pivot $model, mixed $value): void {
80-
$model->setAttribute(
81-
$this->getRelation($model->pivotParent)->getRelatedPivotKeyName(),
82-
$value
83-
);
84-
})->display(fn(Model $model): ?string => $this->resolveDisplay($model)),
80+
$model->setAttribute(
81+
$this->getRelation($model->pivotParent)->getRelatedPivotKeyName(),
82+
$value
83+
);
84+
})->display(fn (Model $model): ?string => $this->resolveDisplay($model)),
8585
];
8686
}
8787

@@ -107,7 +107,7 @@ protected function resolveField(Request $request, Field $field): void
107107
}
108108

109109
if ($field instanceof Relation) {
110-
$field->resolveRouteKeyNameUsing(fn(): string => Str::of($field->getRelationName())->singular()->ucfirst()->prepend($this->getRouteKeyName())->value());
110+
$field->resolveRouteKeyNameUsing(fn (): string => Str::of($field->getRelationName())->singular()->ucfirst()->prepend($this->getRouteKeyName())->value());
111111
}
112112

113113
parent::resolveField($request, $field);
@@ -136,7 +136,7 @@ public function withPivotFields(Closure $callback): static
136136
$field->setModelAttribute($attribute)
137137
->name($attribute)
138138
->id($attribute)
139-
->value(fn(): mixed => $related->getRelation($this->getRelation($model)->getPivotAccessor())->getAttribute($key));
139+
->value(fn (): mixed => $related->getRelation($this->getRelation($model)->getPivotAccessor())->getAttribute($key));
140140
});
141141

142142
return $fields;
@@ -162,7 +162,7 @@ public function mergePivotValues(array $value): array
162162
{
163163
$value = array_is_list($value) ? array_fill_keys($value, []) : $value;
164164

165-
return array_map(fn(array $pivot): array => array_merge($this->pivotValues, $pivot), $value);
165+
return array_map(fn (array $pivot): array => array_merge($this->pivotValues, $pivot), $value);
166166
}
167167

168168
/**

src/Fields/Boolean.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function resolveValue(Request $request, Model $model): bool
6060
public function resolveFormat(Request $request, Model $model): ?string
6161
{
6262
if (is_null($this->formatResolver)) {
63-
$this->formatResolver = static fn(Request $request, Model $model, ?bool $value): string => sprintf(
63+
$this->formatResolver = static fn (Request $request, Model $model, ?bool $value): string => sprintf(
6464
'<span class="status %s">%s</span>',
6565
$value ? 'status--success' : 'status--danger',
6666
$value ? __('Yes') : __('No')

src/Fields/Date.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function getValue(Model $model): mixed
132132
public function resolveFormat(Request $request, Model $model): ?string
133133
{
134134
if (is_null($this->formatResolver)) {
135-
$this->formatResolver = fn(Request $request, Model $model, mixed $value): ?string => is_null($value) ? $value : $value->format($this->format);
135+
$this->formatResolver = fn (Request $request, Model $model, mixed $value): ?string => is_null($value) ? $value : $value->format($this->format);
136136
}
137137

138138
return parent::resolveFormat($request, $model);

src/Fields/Dropdown.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ public function toInput(Request $request, Model $model): array
3333
$data = parent::toInput($request, $model);
3434

3535
return array_merge($data, [
36-
'options' => array_map(static fn(array $option): array => array_merge($option, [
36+
'options' => array_map(static fn (array $option): array => array_merge($option, [
3737
'html' => View::make('root::fields.dropdown-option', $option)->render(),
3838
]), $data['options']),
3939
'selection' => Collection::make($data['options'])
4040
->filter(fn (array $option): bool => $option['selected'] ?? false)
41-
->map(static fn(array $option): array => array_merge($option, [
41+
->map(static fn (array $option): array => array_merge($option, [
4242
'html' => View::make('root::fields.dropdown-option', $option)->render(),
4343
]))
4444
->values()

src/Fields/Editor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected function newMediaField(): Media
119119
{
120120
public function __construct(string $modelAttribute)
121121
{
122-
parent::__construct(__('Media'), $modelAttribute.'-media', static fn(): MorphToMany => new MorphToMany(
122+
parent::__construct(__('Media'), $modelAttribute.'-media', static fn (): MorphToMany => new MorphToMany(
123123
Medium::proxy()->newQuery(),
124124
new class extends Model
125125
{

src/Fields/Field.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ public function toValidate(Request $request, Model $model): array
661661
$key = $model->exists ? 'update' : 'create';
662662

663663
$rules = array_map(
664-
static fn(array|Closure $rule): array => is_array($rule) ? $rule : call_user_func_array($rule, [$request, $model]),
664+
static fn (array|Closure $rule): array => is_array($rule) ? $rule : call_user_func_array($rule, [$request, $model]),
665665
Arr::only($this->rules, array_unique(['*', $key]))
666666
);
667667

src/Fields/Fields.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,23 @@ public function sortable(): static
7272
*/
7373
public function relation(): static
7474
{
75-
return $this->filter(static fn(Field $field): bool => $field instanceof Relation);
75+
return $this->filter(static fn (Field $field): bool => $field instanceof Relation);
7676
}
7777

7878
/**
7979
* Filter the translatable fields.
8080
*/
8181
public function translatable(): static
8282
{
83-
return $this->filter(static fn(Field $field): bool => $field->isTranslatable());
83+
return $this->filter(static fn (Field $field): bool => $field->isTranslatable());
8484
}
8585

8686
/**
8787
* Filter the subresource fields.
8888
*/
8989
public function subResource(bool $value = true): static
9090
{
91-
return $this->filter(static fn(Field $field): bool => $value
91+
return $this->filter(static fn (Field $field): bool => $value
9292
? $field instanceof Relation && $field->isSubResource()
9393
: ! $field instanceof Relation || ! $field->isSubResource());
9494
}
@@ -98,7 +98,7 @@ public function subResource(bool $value = true): static
9898
*/
9999
public function mapToValidate(Request $request, Model $model): array
100100
{
101-
return $this->reduce(static fn(array $rules, Field $field): array => array_merge_recursive($rules, $field->toValidate($request, $model)), []);
101+
return $this->reduce(static fn (array $rules, Field $field): array => array_merge_recursive($rules, $field->toValidate($request, $model)), []);
102102
}
103103

104104
/**

0 commit comments

Comments
 (0)