main

filamentphp/demo

Last updated at: 29/12/2023 09:42

EditProduct.php

TLDR

The EditProduct.php file is a part of the Demo Projects project and is located at app/Filament/Resources/Shop/ProductResource/Pages/. This file contains a class EditProduct that extends the EditRecord class and is used to edit a product resource. It defines one method getActions() that returns an array of actions, including the DeleteAction action.

Classes

EditProduct

The EditProduct class extends the EditRecord class and is responsible for editing a product resource. It has a static property $resource that specifies the resource class it is associated with. In this case, the resource class is ProductResource. The EditProduct class also overrides the getActions() method to define the available actions for editing a product. Currently, it only includes the DeleteAction.

<?php

namespace App\Filament\Resources\Shop\ProductResource\Pages;

use App\Filament\Resources\Shop\ProductResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditProduct extends EditRecord
{
    protected static string $resource = ProductResource::class;

    protected function getActions(): array
    {
        return [
            Actions\DeleteAction::make(),
        ];
    }
}