refactor: Make content recap type field nullable in the database, migration command, and Filament form.
This commit is contained in:
parent
3346e6bec3
commit
3cd6b39d3f
@ -105,13 +105,13 @@ public function handle()
|
|||||||
$this->info('Content recap migration completed successfully!');
|
$this->info('Content recap migration completed successfully!');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mapContentType(?string $legacyType): int
|
private function mapContentType(?string $legacyType): ?int
|
||||||
{
|
{
|
||||||
return match (strtolower($legacyType ?? '')) {
|
return match (strtolower($legacyType ?? '')) {
|
||||||
'foto' => ContentType::FOTO->value,
|
'foto' => ContentType::FOTO->value,
|
||||||
'grafis' => ContentType::GRAPHIC->value,
|
'grafis' => ContentType::GRAPHIC->value,
|
||||||
'audio video' => ContentType::VIDEO->value,
|
'audio video' => ContentType::VIDEO->value,
|
||||||
default => ContentType::FOTO->value,
|
default => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,6 @@ public static function configure(Schema $schema): Schema
|
|||||||
->label('Tipe')
|
->label('Tipe')
|
||||||
->options(ContentType::options())
|
->options(ContentType::options())
|
||||||
->native(false)
|
->native(false)
|
||||||
->required()
|
|
||||||
->in(implode(',', array_column(ContentType::cases(), 'value'))),
|
->in(implode(',', array_column(ContentType::cases(), 'value'))),
|
||||||
|
|
||||||
Select::make('channel')
|
Select::make('channel')
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public function up(): void
|
|||||||
$table->text('title');
|
$table->text('title');
|
||||||
$table->text('link')->nullable();
|
$table->text('link')->nullable();
|
||||||
$table->date('posting_date')->index();
|
$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('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->enum('social_media', SocialMedia::values())->default(SocialMedia::DISKOMINFO_PURWAKARTA->value)->comment(SocialMedia::comment())->index();
|
||||||
$table->timestamp('created_at')->useCurrent();
|
$table->timestamp('created_at')->useCurrent();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user