PHP code example of albertoarena / filament-truss

1. Go to this page and download the library: Download albertoarena/filament-truss library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

albertoarena / filament-truss example snippets


use AlbertoArena\FilamentTruss\FilamentTrussPlugin;
use Filament\Panel;
use Filament\PanelProvider;

class AdminPanelProvider extends PanelProvider
{
    public function panel(Panel $panel): Panel
    {
        return $panel
            // ...
            ->plugin(FilamentTrussPlugin::make());
    }
}

   Gate::define('viewTruss', fn ($user) => $user->isAdmin());
   

use AlbertoArena\FilamentTruss\Actions\Concerns\HasViewInSchemaAction;
use Filament\Resources\Resource;

class BookResource extends Resource
{
    use HasViewInSchemaAction;

    // ...
}

// In a page's header, a table's row actions, or anywhere else that takes an action
BookResource::viewInSchemaAction();

use AlbertoArena\FilamentTruss\Actions\ViewInSchemaAction;

ViewInSchemaAction::make()->forModel(Book::class);
ViewInSchemaAction::make()->forTable('books');

$panel->plugin(FilamentTrussPlugin::make()->documentationLink(false));
bash
php artisan vendor:publish --tag=truss-config