main

filamentphp/demo

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

ListCustomers.php

TLDR

The ListCustomers.php file is a part of the Demo Projects project and is located at app/Filament/Resources/Shop/CustomerResource/Pages/. It is a PHP file that extends the ListRecords class and defines the ListCustomers class. The file controls the creation of the list of customers in the shop and includes a getActions method.

Classes

ListCustomers

The ListCustomers class extends the ListRecords class and is responsible for generating the list of customers in the shop.

Methods

  • getActions(): This method returns an array of actions to be performed on the list of customers. Currently, it includes the CreateAction action.
<?php

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

use App\Filament\Resources\Shop\CustomerResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListCustomers extends ListRecords
{
    protected static string $resource = CustomerResource::class;

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