ht3aa / link-to-relation-text-column
A text column that provide a link to the view or edit page of column relation (the relation should have a filament resource with view or edit page)
Fund package maintenance!
ht3aa
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/ht3aa/link-to-relation-text-column
Requires
- php: ^8.1
- filament/filament: ^3.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- larastan/larastan: ^2.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9|^8.0
- orchestra/testbench: ^8.0|^9.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
This package is auto-updated.
Last update: 2025-12-30 16:34:27 UTC
README
Installation
You can install the package via composer (for now only support filament v3):
composer require ht3aa/link-to-relation-text-column
Usage
The LinkToRelationTextColumn class extends Filament's TextColumn and automatically creates clickable links to the view or edit page of related models in your Filament tables.
Basic Usage
Import the class in your Filament resource:
use Ht3aa\LinkToRelationTextColumn\LinkToRelationTextColumn;
Then use it in your table definition. The column will automatically detect the related model and find its corresponding Filament resource:
use Ht3aa\LinkToRelationTextColumn\LinkToRelationTextColumn; public static function table(Table $table): Table { return $table ->columns([ LinkToRelationTextColumn::make('user.name') ->label('User'), // ... other columns ]); }
The column will:
- Automatically detect the related model (e.g.,
Userfrom theuserrelation) - Find the corresponding Filament resource for that model
- Create a link to the view page (if available) or edit page (if view is not available)
- Display an icon (arrow-top-right-on-square) when a link is available
Specifying a Resource Manually
If you need to explicitly specify which Filament resource to use, you can use the relationResource() method:
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 ]); }
Example: Complete Table Definition
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 ]); }
Credits
License
The MIT License (MIT). Please see License File for more information.
