44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Admin\Resources\CompanyHistoryItems\Pages;
|
|
|
|
use App\Filament\Admin\Resources\CompanyHistoryItems\CompanyHistoryItemResource;
|
|
use App\Filament\Admin\Resources\Components\TranslationTabs;
|
|
use Filament\Resources\Pages\CreateRecord;
|
|
|
|
class CreateCompanyHistoryItem extends CreateRecord
|
|
{
|
|
protected static string $resource = CompanyHistoryItemResource::class;
|
|
|
|
public function getTitle(): string
|
|
{
|
|
return __('company_history.create');
|
|
}
|
|
|
|
protected function getRedirectUrl(): string
|
|
{
|
|
return $this->getResource()::getUrl('index');
|
|
}
|
|
|
|
protected function getCreatedNotificationTitle(): ?string
|
|
{
|
|
return __('company_history.created_successfully');
|
|
}
|
|
|
|
protected function mutateFormDataBeforeCreate(array $data): array
|
|
{
|
|
if (empty($data['position'])) {
|
|
$data['position'] = null;
|
|
}
|
|
|
|
unset($data['color_custom']);
|
|
|
|
return $data;
|
|
}
|
|
|
|
protected function afterCreate(): void
|
|
{
|
|
TranslationTabs::saveTranslations($this->record, $this->form->getState());
|
|
}
|
|
}
|