diff --git a/app/Filament/Resources/Manage/Cooperations/CooperationResource.php b/app/Filament/Resources/Manage/Cooperations/CooperationResource.php index 2d3cf17..d927588 100644 --- a/app/Filament/Resources/Manage/Cooperations/CooperationResource.php +++ b/app/Filament/Resources/Manage/Cooperations/CooperationResource.php @@ -139,11 +139,11 @@ public static function infolist(Schema $schema): Schema ImageEntry::make('banner') ->label('Banner') - ->getStateUsing(fn (Cooperation $record): ?string => optional($record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->sortByDesc('created_at')->first())->getPathRelativeToRoot()) + ->getStateUsing(fn (Cooperation $record): ?string => optional($record->getMedia('banner')->sortByDesc('created_at')->first() ?? $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->sortByDesc('created_at')->first())->getPathRelativeToRoot()) ->disk(config('filesystems.default')) - ->visible(fn (Cooperation $record): bool => $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty()), + ->visible(fn (Cooperation $record): bool => $record->getMedia('banner')->isNotEmpty() || $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty()), ]) - ->visible(fn (Cooperation $record): bool => $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty() && $record->getMedia('cooperations')->where('custom_properties.doc_type', 'proposal-template')->isNotEmpty()), + ->visible(fn (Cooperation $record): bool => $record->getMedia('banner')->isNotEmpty() || $record->getMedia('cooperations')->where('custom_properties.doc_type', 'banner')->isNotEmpty() || $record->getMedia('cooperations')->where('custom_properties.doc_type', 'proposal-template')->isNotEmpty()), TextEntry::make('description') ->label('Deskripsi'), diff --git a/app/Filament/Resources/Manage/Cooperations/Schemas/CooperationForm.php b/app/Filament/Resources/Manage/Cooperations/Schemas/CooperationForm.php index 155b0fb..b3fd435 100644 --- a/app/Filament/Resources/Manage/Cooperations/Schemas/CooperationForm.php +++ b/app/Filament/Resources/Manage/Cooperations/Schemas/CooperationForm.php @@ -90,7 +90,7 @@ public static function configure(Schema $schema): Schema ->disk(config('filesystems.default')) ->acceptedFileTypes(['image/*']) ->maxSize(1024 * 3) - ->collection('cooperations') + ->collection('banner') ->customProperties(fn (): array => [ 'feature' => 'cooperations', 'doc_type' => 'banner',