PHP code example of ht3aa / link-to-relation-text-column

1. Go to this page and download the library: Download ht3aa/link-to-relation-text-column 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/ */

    

ht3aa / link-to-relation-text-column example snippets


use Ht3aa\LinkToRelationTextColumn\LinkToRelationTextColumn;

use Ht3aa\LinkToRelationTextColumn\LinkToRelationTextColumn;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            LinkToRelationTextColumn::make('user.name')
                ->label('User'),
            // ... other columns
        ]);
}

use Ht3aa\LinkToRelationTextColumn\LinkToRelationTextColumn;
use App\Filament\Resources\UserResource;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            LinkToRelationTextColumn::make('user.name')
                ->label('User')
                ->relationResource(UserResource::class),
            // ... other columns
        ]);
}

use Filament\Tables\Table;
use Ht3aa\LinkToRelationTextColumn\LinkToRelationTextColumn;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            TextColumn::make('id'),
            LinkToRelationTextColumn::make('author.name')
                ->label('Author')
                ->searchable(),
            LinkToRelationTextColumn::make('category.name')
                ->label('Category')
                ->relationResource(CategoryResource::class),
            // ... other columns
        ]);
}