main

filamentphp/demo

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

ManageCategories.php

TLDR

This file defines a class called ManageCategories which extends the ManageRecords class. It is part of the CategoryResource in the Blog namespace of the Filament resource. It sets the $resource property to CategoryResource::class and implements the getActions() method.

Classes

ManageCategories

The ManageCategories class extends the ManageRecords class. It is responsible for managing the categories in the blog category resource. It sets the $resource property to the CategoryResource class. It also defines the getActions() method, which returns an array of actions including an import action and a create action.

<?php

namespace App\Filament\Resources\Blog\CategoryResource\Pages;

use App\Filament\Imports\Blog\CategoryImporter;
use App\Filament\Resources\Blog\CategoryResource;
use Filament\Actions;
use Filament\Resources\Pages\ManageRecords;

class ManageCategories extends ManageRecords
{
    protected static string $resource = CategoryResource::class;

    protected function getActions(): array
    {
        return [
            Actions\ImportAction::make()
                ->importer(CategoryImporter::class),
            Actions\CreateAction::make(),
        ];
    }
}