EditCategory.php
TLDR
This file is a part of the Demo Projects project and is located at app/Filament/Resources/Shop/CategoryResource/Pages/EditCategory.php. It defines the EditCategory
class which extends the EditRecord
class. The class is responsible for editing records of the CategoryResource
. It includes a single method getActions()
that returns an array of actions, with the DeleteAction
as the only action available.
Classes
EditCategory
The EditCategory
class extends the EditRecord
class and is used to edit records of the CategoryResource
. It includes a single method getActions()
that returns an array of actions. This class is located at app/Filament/Resources/Shop/CategoryResource/Pages/EditCategory.php.
Methods
getActions()
The getActions()
method is a protected method of the EditCategory
class. It returns an array of actions that are available for the current resource. In this case, the method returns an array containing only the DeleteAction
. The DeleteAction
is responsible for deleting the current record.
<?php
namespace App\Filament\Resources\Shop\CategoryResource\Pages;
use App\Filament\Resources\Shop\CategoryResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditCategory extends EditRecord
{
protected static string $resource = CategoryResource::class;
protected function getActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}