taxonomy create/edit redirect

This commit is contained in:
xiaomlove
2022-11-09 21:56:03 +08:00
parent b92b911b1e
commit 6479f0a799
17 changed files with 105 additions and 20 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{
$schedule->command('exam:assign_cronjob')->everyMinute()->withoutOverlapping();
$schedule->command('exam:checkout_cronjob')->everyMinute()->withoutOverlapping();
$schedule->command('exam:checkout_cronjob')->everyFiveMinutes()->withoutOverlapping();
$schedule->command('exam:update_progress --bulk=1')->hourly()->withoutOverlapping();
$schedule->command('backup:cronjob')->everyMinute()->withoutOverlapping();
$schedule->command('hr:update_status')->everyTenMinutes()->withoutOverlapping();
@@ -5,8 +5,9 @@ namespace App\Filament\Resources\Section\AudioCodecResource\Pages;
use App\Filament\Resources\Section\AudioCodecResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;
use App\Filament\Resources\Section\CodecResource\Pages\CreateCodec;
class CreateAudioCodec extends CreateRecord
class CreateAudioCodec extends CreateCodec
{
protected static string $resource = AudioCodecResource::class;
}
@@ -9,4 +9,20 @@ use Filament\Resources\Pages\CreateRecord;
class CreateCodec extends CreateRecord
{
protected static string $resource = CodecResource::class;
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;
}
}
@@ -23,6 +23,17 @@ class EditCodec extends EditRecord
public function afterSave()
{
clear_search_box_cache();
$model = static::$resource::getModel();
$table = (new $model)->getTable();
clear_taxonomy_cache($table);
}
protected function mutateFormDataBeforeSave(array $data): array
{
if ($data['mode'] === null) {
$data['mode'] = 0;
}
return $data;
}
}
@@ -2,11 +2,12 @@
namespace App\Filament\Resources\Section\MediaResource\Pages;
use App\Filament\Resources\Section\CodecResource\Pages\CreateCodec;
use App\Filament\Resources\Section\MediaResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateMedia extends CreateRecord
class CreateMedia extends CreateCodec
{
protected static string $resource = MediaResource::class;
}
@@ -5,8 +5,9 @@ namespace App\Filament\Resources\Section\ProcessingResource\Pages;
use App\Filament\Resources\Section\ProcessingResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;
use App\Filament\Resources\Section\CodecResource\Pages\CreateCodec;
class CreateProcessing extends CreateRecord
class CreateProcessing extends CreateCodec
{
protected static string $resource = ProcessingResource::class;
}
@@ -61,6 +61,12 @@ class SecondIconResource extends Resource
->label(__('label.second_icon.class_name'))
->helperText(__('label.second_icon.class_name_help'))
,
Forms\Components\Select::make('mode')
->options($modeOptions)
->label(__('label.search_box.taxonomy.mode'))
->helperText(__('label.search_box.taxonomy.mode_help'))
->reactive()
,
Forms\Components\Section::make(__('label.second_icon.select_section'))
->id("taxonomy_$torrentMode")
->schema($torrentTaxonomySchema)
@@ -73,11 +79,7 @@ class SecondIconResource extends Resource
->columns(4)
->hidden(fn (\Closure $get) => $get('mode') != $specialMode)
,
Forms\Components\Select::make('mode')
->options($modeOptions)
->label(__('label.search_box.taxonomy.mode'))
->helperText(__('label.search_box.taxonomy.mode_help'))
,
]);
}
@@ -5,8 +5,9 @@ namespace App\Filament\Resources\Section\SourceResource\Pages;
use App\Filament\Resources\Section\SourceResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;
use App\Filament\Resources\Section\CodecResource\Pages\CreateCodec;
class CreateSource extends CreateRecord
class CreateSource extends CreateCodec
{
protected static string $resource = SourceResource::class;
}
@@ -5,8 +5,9 @@ namespace App\Filament\Resources\Section\StandardResource\Pages;
use App\Filament\Resources\Section\StandardResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;
use App\Filament\Resources\Section\CodecResource\Pages\CreateCodec;
class CreateStandard extends CreateRecord
class CreateStandard extends CreateCodec
{
protected static string $resource = StandardResource::class;
}
@@ -5,8 +5,9 @@ namespace App\Filament\Resources\Section\TeamResource\Pages;
use App\Filament\Resources\Section\TeamResource;
use Filament\Pages\Actions;
use Filament\Resources\Pages\CreateRecord;
use App\Filament\Resources\Section\CodecResource\Pages\CreateCodec;
class CreateTeam extends CreateRecord
class CreateTeam extends CreateCodec
{
protected static string $resource = TeamResource::class;
}
+4 -1
View File
@@ -16,12 +16,15 @@ class SecondIcon extends NexusModel
{
foreach (SearchBox::$taxonomies as $torrentField => $table) {
$mode = $data['mode'];
if (empty($data[$torrentField][$mode])) {
if ($mode === null || empty($data[$torrentField][$mode])) {
unset($data[$torrentField]);
} else {
$data[$torrentField] = $data[$torrentField][$mode];
}
}
if ($data['mode'] === null) {
$data['mode'] = 0;
}
return $data;
}