mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
section basic
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SecondIconResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SecondIconResource;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\SecondIcon;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateSecondIcon extends CreateRecord
|
||||
{
|
||||
protected static string $resource = SecondIconResource::class;
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
return SecondIcon::formatFormData($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SecondIconResource\Pages;
|
||||
|
||||
use App\Filament\Resources\Section\SecondIconResource;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\SecondIcon;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSecondIcon extends EditRecord
|
||||
{
|
||||
protected static string $resource = SecondIconResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
return SecondIcon::formatFormData($data);
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
$mode = $data['mode'];
|
||||
foreach (SearchBox::$taxonomies as $torrentField => $table) {
|
||||
$taxonomyValue = $data[$torrentField] ?? null;
|
||||
unset($data[$torrentField]);
|
||||
$data[$torrentField][$mode] = $taxonomyValue;
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Section\SecondIconResource\Pages;
|
||||
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\Section\SecondIconResource;
|
||||
use App\Models\SecondIcon;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class ListSecondIcons extends PageList
|
||||
{
|
||||
protected static string $resource = SecondIconResource::class;
|
||||
|
||||
protected function getActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return SecondIcon::query()->with('search_box');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user