2026-01-02 13:58:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2026-01-02 16:56:48 +00:00
|
|
|
use Filament\Forms\Components\RichEditor\FileAttachmentProviders\SpatieMediaLibraryFileAttachmentProvider;
|
|
|
|
|
use Filament\Forms\Components\RichEditor\Models\Concerns\InteractsWithRichContent;
|
|
|
|
|
use Filament\Forms\Components\RichEditor\Models\Contracts\HasRichContent;
|
2026-01-02 13:58:06 +00:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2026-01-02 16:56:48 +00:00
|
|
|
use Spatie\MediaLibrary\HasMedia;
|
|
|
|
|
use Spatie\MediaLibrary\InteractsWithMedia;
|
|
|
|
|
|
|
|
|
|
class Entry extends Model implements HasRichContent, HasMedia
|
2026-01-02 13:58:06 +00:00
|
|
|
|
|
|
|
|
{
|
2026-01-02 16:56:48 +00:00
|
|
|
|
|
|
|
|
use InteractsWithMedia, InteractsWithRichContent;
|
|
|
|
|
|
2026-01-02 13:58:06 +00:00
|
|
|
protected $fillable = [
|
|
|
|
|
'title',
|
|
|
|
|
'slug',
|
|
|
|
|
'description',
|
|
|
|
|
'is_published',
|
|
|
|
|
'is_featured',
|
|
|
|
|
'published_at',
|
|
|
|
|
'content',
|
|
|
|
|
];
|
2026-01-02 16:56:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set up rich content configuration for media library integration
|
|
|
|
|
*/
|
|
|
|
|
public function setUpRichContent(): void
|
|
|
|
|
{
|
|
|
|
|
$this->registerRichContent('content')
|
|
|
|
|
->fileAttachmentProvider(
|
|
|
|
|
SpatieMediaLibraryFileAttachmentProvider::make()
|
|
|
|
|
->collection('content-attachments')
|
|
|
|
|
->preserveFilenames()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-02 13:58:06 +00:00
|
|
|
}
|