main

filamentphp/demo

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

ViewPost.php

TLDR

This file is a part of the Demo Projects project and is located at app/Filament/Resources/Blog/PostResource/Pages/ViewPost.php. It contains a class named ViewPost that extends the ViewRecord class.

Classes

ViewPost

This class extends the ViewRecord class and is a part of the Blog\PostResource\Pages namespace. It serves as a resource for viewing a specific post and is associated with the PostResource resource. The ViewPost class contains the following methods:

getTitle()

This method returns the title of the record associated with the current resource. It can return a string or an Htmlable instance.

getActions()

This method returns an empty array of actions for the current resource.

<?php

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

use App\Filament\Resources\Blog\PostResource;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Contracts\Support\Htmlable;

class ViewPost extends ViewRecord
{
    protected static string $resource = PostResource::class;

    public function getTitle(): string | Htmlable
    {
        return $this->record->title;
    }

    protected function getActions(): array
    {
        return [];
    }
}