Skip to content

Commit

Permalink
fix: phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
Z3d0X committed Jun 10, 2023
1 parent 387b858 commit 4479e93
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Resources/ActivityResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Spatie\Activitylog\Contracts\Activity;
use Spatie\Activitylog\Models\Activity as ActivityModel;
use Spatie\Activitylog\ActivitylogServiceProvider;
use Z3d0X\FilamentLogger\Resources\ActivityResource\Pages;

Expand All @@ -46,7 +47,7 @@ public static function form(Form $form): Form

TextInput::make('subject_type')
->afterStateHydrated(function ($component, ?Model $record, $state) {
/** @var Activity $record */
/** @var Activity&ActivityModel $record */
return $state ? $component->state(Str::of($state)->afterLast('\\')->headline().' # '.$record->subject_id) : '-';
})
->label(__('filament-logger::filament-logger.resource.label.subject')),
Expand All @@ -64,7 +65,7 @@ public static function form(Form $form): Form
Card::make([
Placeholder::make('log_name')
->content(function (?Model $record): string {
/** @var Activity $record */
/** @var Activity&ActivityModel $record */
return $record->log_name ? ucwords($record->log_name) : '-';
})
->label(__('filament-logger::filament-logger.resource.label.type')),
Expand All @@ -79,15 +80,16 @@ public static function form(Form $form): Form
Placeholder::make('created_at')
->label(__('filament-logger::filament-logger.resource.label.event'))
->content(function (?Model $record): string {
/** @var Activity $record */
/** @var Activity&ActivityModel $record */
return $record->created_at ? "{$record->created_at->format(config('filament-logger.datetime_format', 'd/m/Y H:i:s'))}" : '-';
}),
])
]),
Card::make()
->columns()
->visible(fn ($record) => $record->properties?->count() > 0)
->schema(function (?Activity $record) {
->schema(function (?Model $record) {
/** @var Activity&ActivityModel $record */
$properties = $record->properties->except(['attributes', 'old']);

$schema = [];
Expand Down Expand Up @@ -139,7 +141,7 @@ public static function table(Table $table): Table
TextColumn::make('subject_type')
->label(__('filament-logger::filament-logger.resource.label.subject'))
->formatStateUsing(function ($state, Model $record) {
/** @var Activity $record */
/** @var Activity&ActivityModel $record */
if (!$state) {
return '-';
}
Expand Down

0 comments on commit 4479e93

Please sign in to comment.