feat: Store cooperation banners in a dedicated 'banner' media collection and update display logic to support both new and old storage.
This commit is contained in:
parent
a6ab65adc4
commit
b1bcb5dd14
@ -139,11 +139,11 @@ public static function infolist(Schema $schema): Schema
|
|||||||
|
|
||||||
ImageEntry::make('banner')
|
ImageEntry::make('banner')
|
||||||
->label('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'))
|
->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')
|
TextEntry::make('description')
|
||||||
->label('Deskripsi'),
|
->label('Deskripsi'),
|
||||||
|
|||||||
@ -90,7 +90,7 @@ public static function configure(Schema $schema): Schema
|
|||||||
->disk(config('filesystems.default'))
|
->disk(config('filesystems.default'))
|
||||||
->acceptedFileTypes(['image/*'])
|
->acceptedFileTypes(['image/*'])
|
||||||
->maxSize(1024 * 3)
|
->maxSize(1024 * 3)
|
||||||
->collection('cooperations')
|
->collection('banner')
|
||||||
->customProperties(fn (): array => [
|
->customProperties(fn (): array => [
|
||||||
'feature' => 'cooperations',
|
'feature' => 'cooperations',
|
||||||
'doc_type' => 'banner',
|
'doc_type' => 'banner',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user