Files
nexusphp/app/Filament/Resources/Section/CodecResource/Pages/CreateCodec.php

32 lines
769 B
PHP
Raw Normal View History

2022-10-27 20:21:54 +08:00
<?php
namespace App\Filament\Resources\Section\CodecResource\Pages;
2022-12-01 00:45:22 +08:00
use App\Filament\CreateRedirectIndexTrait;
2022-10-27 20:21:54 +08:00
use App\Filament\Resources\Section\CodecResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateCodec extends CreateRecord
{
2022-12-01 00:45:22 +08:00
use CreateRedirectIndexTrait;
2022-10-27 20:21:54 +08:00
protected static string $resource = CodecResource::class;
2022-11-09 21:56:03 +08:00
public function afterCreate()
{
clear_search_box_cache();
$model = static::$resource::getModel();
$table = (new $model)->getTable();
clear_taxonomy_cache($table);
}
protected function mutateFormDataBeforeCreate(array $data): array
{
if ($data['mode'] === null) {
$data['mode'] = 0;
}
return $data;
}
2022-10-27 20:21:54 +08:00
}