Skip to content

Commit 0d78255

Browse files
committed
Apply fixes from StyleCI
1 parent e55a05b commit 0d78255

30 files changed

+96
-100
lines changed

src/Actions/ActionEvent.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ public function target()
6565
$queryWithTrashed = static fn ($query) => $query->withTrashed();
6666

6767
return $this->morphTo('target', 'target_type', 'target_id')
68-
->constrain(
69-
collect(Nova::$resources)
70-
->filter(static fn ($resource) => $resource::softDeletes())
71-
->mapWithKeys(static fn ($resource) => [$resource::$model => $queryWithTrashed])
72-
->all()
73-
)->when(true, static fn ($query) => $query->hasMacro('withTrashed') ? $queryWithTrashed($query) : $query);
68+
->constrain(
69+
collect(Nova::$resources)
70+
->filter(static fn ($resource) => $resource::softDeletes())
71+
->mapWithKeys(static fn ($resource) => [$resource::$model => $queryWithTrashed])
72+
->all()
73+
)->when(true, static fn ($query) => $query->hasMacro('withTrashed') ? $queryWithTrashed($query) : $query);
7474
}
7575

7676
/**
@@ -344,9 +344,9 @@ public static function prune(Collection $models, int $limit = 25): void
344344
->whereNotIn('id', static function ($query) use ($model, $limit) {
345345
$query->select('id')->fromSub(
346346
static::select('id')->orderBy('id', 'desc')
347-
->where('actionable_id', $model['actionable_id'])
348-
->where('actionable_type', $model['actionable_type'])
349-
->limit($limit)->toBase(),
347+
->where('actionable_id', $model['actionable_id'])
348+
->where('actionable_type', $model['actionable_type'])
349+
->limit($limit)->toBase(),
350350
'action_events_temp'
351351
);
352352
})->delete();
@@ -359,7 +359,7 @@ public static function prune(Collection $models, int $limit = 25): void
359359
public static function markBatchAsRunning(string $batchId): int
360360
{
361361
return static::where('batch_id', $batchId)
362-
->whereNotIn('status', ['finished', 'failed'])->update([
362+
->whereNotIn('status', ['finished', 'failed'])->update([
363363
'status' => 'running',
364364
]);
365365
}
@@ -370,7 +370,7 @@ public static function markBatchAsRunning(string $batchId): int
370370
public static function markBatchAsFinished(string $batchId): int
371371
{
372372
return static::where('batch_id', $batchId)
373-
->whereNotIn('status', ['finished', 'failed'])->update([
373+
->whereNotIn('status', ['finished', 'failed'])->update([
374374
'status' => 'finished',
375375
]);
376376
}
@@ -393,7 +393,7 @@ public static function markAsFinished(string $batchId, $model): int
393393
public static function markBatchAsFailed(string $batchId, Throwable|string|null $e = null): int
394394
{
395395
return static::where('batch_id', $batchId)
396-
->whereNotIn('status', ['finished', 'failed'])->update([
396+
->whereNotIn('status', ['finished', 'failed'])->update([
397397
'status' => 'failed',
398398
'exception' => $e ? (string) $e : '',
399399
]);
@@ -417,9 +417,9 @@ public static function markAsFailed(string $batchId, $model, Throwable|string|nu
417417
public static function updateStatus(string $batchId, $model, string $status, Throwable|string|null $e = null): int
418418
{
419419
return static::where('batch_id', $batchId)
420-
->where('model_type', $model->getMorphClass())
421-
->where('model_id', $model->getKey())
422-
->update(['status' => $status, 'exception' => (string) $e]);
420+
->where('model_type', $model->getMorphClass())
421+
->where('model_id', $model->getKey())
422+
->update(['status' => $status, 'exception' => (string) $e]);
423423
}
424424

425425
/**

src/Actions/CallQueuedAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function handle()
5858
}
5959

6060
return $action->withActionBatchId($this->actionBatchId)
61-
->{$this->method}($this->fields, $this->models);
61+
->{$this->method}($this->fields, $this->models);
6262
});
6363
}
6464

src/Auth/Actions/LoginViewResponse.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function toResponse($request)
1919
$initialYear = config('app.initialyear', date('Y'));
2020
$currentYear = date('Y');
2121
$years = $initialYear <= $currentYear ? range($initialYear, $currentYear) : [];
22+
2223
return Inertia::render('Nova.Login', [
2324
'username' => Nova::fortify()->username,
2425
'email' => Nova::fortify()->email,

src/Auth/Actions/LogoutResponse.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Http\JsonResponse;
66
use Laravel\Fortify\Contracts\LogoutResponse as Responsable;
7-
use Laravel\Nova\Nova;
87

98
class LogoutResponse implements Responsable
109
{

src/Concerns/HandlesRoutes.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public static function url(?string $url = null): string
4646
public static function router(?array $middleware = null, ?string $prefix = null): RouteRegistrar
4747
{
4848
return Route::domain(config('nova.domain', null))
49-
->prefix(static::url($prefix))
50-
->middleware($middleware ?? config('nova.middleware', []));
49+
->prefix(static::url($prefix))
50+
->middleware($middleware ?? config('nova.middleware', []));
5151
}
5252

5353
/**

src/Fields/DetachesPivotModels.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ protected function detachmentCallback(): callable
2626
$pivotFields = $resource->resolvePivotFields($request, $request->resource);
2727

2828
$pivotFields->whereInstanceOf(Deletable::class)
29-
->filter->isPrunable()
30-
->each(static function ($field) use ($request, $pivot) {
31-
/** @var \Laravel\Nova\Fields\Field&\Laravel\Nova\Contracts\Deletable $field */
32-
DeleteField::forRequest($request, $field, $pivot)->save();
33-
});
29+
->filter->isPrunable()
30+
->each(static function ($field) use ($request, $pivot) {
31+
/** @var \Laravel\Nova\Fields\Field&\Laravel\Nova\Contracts\Deletable $field */
32+
DeleteField::forRequest($request, $field, $pivot)->save();
33+
});
3434

3535
$pivot->delete();
3636
}

src/Fields/HasOne.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,16 @@ public function __construct($name, ?string $attribute = null, ?string $resource
120120

121121
if ($this->ofManyRelationship === false && $request->viaRelationship === $this->attribute && $request->viaResourceId) {
122122
$parent = $parentResource::newModel()
123-
->with($this->attribute)
124-
->find($request->viaResourceId);
123+
->with($this->attribute)
124+
->find($request->viaResourceId);
125125

126126
return optional($parent->{$this->attribute})->exists === true;
127127
}
128128

129129
return false;
130130
})->showOnCreating(static fn ($request) => ! in_array($request->relationshipType, ['hasOne', 'morphOne']))
131-
->showOnUpdating(static fn ($request) => ! in_array($request->relationshipType, ['hasOne', 'morphOne']))
132-
->nullable();
131+
->showOnUpdating(static fn ($request) => ! in_array($request->relationshipType, ['hasOne', 'morphOne']))
132+
->nullable();
133133
}
134134

135135
/**

src/Fields/ID.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ public static function forResource(Resource $resource): ?static
6565
/** @phpstan-ignore argument.templateType */
6666
$field = transform(
6767
$resource->availableFieldsOnIndexOrDetail(app(NovaRequest::class))
68-
->whereInstanceOf(self::class)
69-
->first(),
68+
->whereInstanceOf(self::class)
69+
->first(),
7070
static fn ($field) => tap($field)->resolve($model),
7171
static fn () => ! is_null($model) && $model->exists ? static::forModel($model) : null,
7272
);

src/Fields/MorphTo.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,9 @@ protected function filterableAttribute(NovaRequest $request)
533533
protected function defaultFilterableCallback()
534534
{
535535
$morphToTypes = collect($this->morphToTypes)
536-
->pluck('type')
537-
->mapWithKeys(static fn ($type) => [$type => $type::newModel()->getMorphClass()])
538-
->all();
536+
->pluck('type')
537+
->mapWithKeys(static fn ($type) => [$type => $type::newModel()->getMorphClass()])
538+
->all();
539539

540540
return static function (NovaRequest $request, $query, $value, $attribute) use ($morphToTypes) {
541541
$query->whereHasMorph(

src/Fields/MorphToMany.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ public function singularLabel(Stringable|string $singularLabel)
229229
public function asPanel(): Panel
230230
{
231231
return Panel::make($this->name, [$this])
232-
->withMeta([
233-
'prefixComponent' => true,
234-
])->withComponent('relationship-panel');
232+
->withMeta([
233+
'prefixComponent' => true,
234+
])->withComponent('relationship-panel');
235235
}
236236

237237
/**

0 commit comments

Comments
 (0)