webseite funktioniert, pay sdk, blog backend funktioniert
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Blog\Resources\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Blog\Resources\CategoryResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCategory extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getFormValidationRules(): array
|
||||
{
|
||||
return [
|
||||
'name_de' => 'required|string|max:255',
|
||||
'description_de' => 'nullable|string',
|
||||
'name_en' => 'nullable|string|max:255',
|
||||
'description_en' => 'nullable|string',
|
||||
'slug' => 'required|string|max:255|unique:blog_categories,slug',
|
||||
'is_visible' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
protected function store()
|
||||
{
|
||||
$state = $this->form->getState();
|
||||
$data = $state['data'] ?? $state;
|
||||
|
||||
$data = \App\Filament\Blog\Resources\CategoryResource::mutateFormDataBeforeCreate($data);
|
||||
|
||||
$this->record = static::getResource()::getModel()::create($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Blog\Resources\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Blog\Resources\CategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCategory extends EditRecord
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getFormValidationRules(): array
|
||||
{
|
||||
return [
|
||||
'name_de' => 'required|string|max:255',
|
||||
'description_de' => 'nullable|string',
|
||||
'name_en' => 'nullable|string|max:255',
|
||||
'description_en' => 'nullable|string',
|
||||
'slug' => 'required|string|max:255|unique:blog_categories,slug,' . $this->record->id,
|
||||
'is_visible' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
||||
public function mount($record): void
|
||||
{
|
||||
parent::mount($record);
|
||||
$data = $this->record->toArray();
|
||||
$data = \App\Filament\Blog\Resources\CategoryResource::mutateFormDataBeforeFill($data);
|
||||
$this->form->fill($data);
|
||||
}
|
||||
|
||||
public function save(bool $shouldRedirect = true, bool $shouldSendSavedNotification = true): void
|
||||
{
|
||||
$state = $this->form->getState();
|
||||
\Illuminate\Support\Facades\Log::info('EditCategory Save - Full State:', $state);
|
||||
|
||||
$data = $state['data'] ?? $state;
|
||||
|
||||
$data = \App\Filament\Blog\Resources\CategoryResource::mutateFormDataBeforeSave($data);
|
||||
|
||||
$this->record->update($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Blog\Resources\CategoryResource\Pages;
|
||||
|
||||
use App\Filament\Blog\Resources\CategoryResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCategories extends ListRecords
|
||||
{
|
||||
protected static string $resource = CategoryResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user