© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
malivodka

Is it possible to display hasMany relations into the view action?

I have this livewire component..

<?php

namespace App\Livewire;

use App\Models\Role;
use App\Services\RolesAndPermissionService;
use Filament\Tables\Actions\EditAction;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;
use Livewire\Component;
use Filament\Tables;
use Filament\Forms;

class RolesAndPermissions extends Component implements HasTable, HasForms
{
    use InteractsWithTable, InteractsWithForms;

    public function render()
    {
        return view('livewire.roles-and-permissions');
    }

    public function table(Table $table): Table
    {
        return $table
            ->query(Role::query())
            ->columns([
                Tables\Columns\TextColumn::make('name'),
                Tables\Columns\TextColumn::make('label'),
            ])
            ->actions([
                Tables\Actions\ViewAction::make()
                    ->slideOver()
                    ->form(RolesAndPermissionService::schema()),
                EditAction::make()
                    ->slideOver()
                    ->form(RolesAndPermissionService::schema()),
                Tables\Actions\DeleteAction::make()
            ])
            ->headerActions([
                Tables\Actions\CreateAction::make()
                    ->slideOver()
                    ->model(Role::class)
                    ->form(RolesAndPermissionService::schema())
            ]);
    }
}
<?php

namespace App\Livewire;

use App\Models\Role;
use App\Services\RolesAndPermissionService;
use Filament\Tables\Actions\EditAction;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Tables\Concerns\InteractsWithTable;
use Filament\Tables\Contracts\HasTable;
use Filament\Tables\Table;
use Livewire\Component;
use Filament\Tables;
use Filament\Forms;

class RolesAndPermissions extends Component implements HasTable, HasForms
{
    use InteractsWithTable, InteractsWithForms;

    public function render()
    {
        return view('livewire.roles-and-permissions');
    }

    public function table(Table $table): Table
    {
        return $table
            ->query(Role::query())
            ->columns([
                Tables\Columns\TextColumn::make('name'),
                Tables\Columns\TextColumn::make('label'),
            ])
            ->actions([
                Tables\Actions\ViewAction::make()
                    ->slideOver()
                    ->form(RolesAndPermissionService::schema()),
                EditAction::make()
                    ->slideOver()
                    ->form(RolesAndPermissionService::schema()),
                Tables\Actions\DeleteAction::make()
            ])
            ->headerActions([
                Tables\Actions\CreateAction::make()
                    ->slideOver()
                    ->model(Role::class)
                    ->form(RolesAndPermissionService::schema())
            ]);
    }
}


on this component you see that I set an ViewAction as slideOver.. Is it possible to add all the relations of the item? Lets say that the role has many permissions and I want to list all permissions of that role.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

How to display hasMany
FilamentFFilament / ❓┊help
3y ago
ActionGroup Action caching custom view
FilamentFFilament / ❓┊help
9mo ago
Is it possible to customize table view files?
FilamentFFilament / ❓┊help
3y ago
Is it possible to hide some form elements when calling via view action?
FilamentFFilament / ❓┊help
3y ago