refactor: Make content recap type field nullable in the database, migration command, and Filament form.

This commit is contained in:
Yoga Pangestu 2026-03-16 15:10:30 +07:00
parent 3346e6bec3
commit 3cd6b39d3f
3 changed files with 3 additions and 4 deletions

View File

@ -105,13 +105,13 @@ public function handle()
$this->info('Content recap migration completed successfully!');
}
private function mapContentType(?string $legacyType): int
private function mapContentType(?string $legacyType): ?int
{
return match (strtolower($legacyType ?? '')) {
'foto' => ContentType::FOTO->value,
'grafis' => ContentType::GRAPHIC->value,
'audio video' => ContentType::VIDEO->value,
default => ContentType::FOTO->value,
default => null,
};
}

View File

@ -43,7 +43,6 @@ public static function configure(Schema $schema): Schema
->label('Tipe')
->options(ContentType::options())
->native(false)
->required()
->in(implode(',', array_column(ContentType::cases(), 'value'))),
Select::make('channel')

View File

@ -20,7 +20,7 @@ public function up(): void
$table->text('title');
$table->text('link')->nullable();
$table->date('posting_date')->index();
$table->enum('type', ContentType::values())->default(ContentType::FOTO->value)->comment(ContentType::comment())->index();
$table->enum('type', ContentType::values())->nullable()->default(ContentType::FOTO->value)->comment(ContentType::comment())->index();
$table->enum('channel', Channel::values())->default(Channel::WEBSITE->value)->comment(Channel::comment())->index();
$table->enum('social_media', SocialMedia::values())->default(SocialMedia::DISKOMINFO_PURWAKARTA->value)->comment(SocialMedia::comment())->index();
$table->timestamp('created_at')->useCurrent();