main

filamentphp/demo

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

ListLinks.php

TLDR

This file is part of the Demo Projects project and is located at app/Filament/Resources/Blog/LinkResource/Pages/ListLinks.php. It contains a class called ListLinks that extends the ListRecords class and includes the Translatable trait. The class defines a static property $resource and a method getHeaderActions().

Classes

ListLinks

The ListLinks class is responsible for displaying a list of records. It extends the ListRecords class and includes the Translatable trait. It defines a static property $resource which is set to the LinkResource class.

Methods

getHeaderActions()

The getHeaderActions() method returns an array of actions to be displayed in the header section of the list view. It includes the CreateAction and LocaleSwitcher actions.

<?php

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

use App\Filament\Resources\Blog\LinkResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListLinks extends ListRecords
{
    use ListRecords\Concerns\Translatable;

    protected static string $resource = LinkResource::class;

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