Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mstdmstd's avatar

How with RelationManager hide/show action on condition ?

Using RelationManager in Laravel 10/Filamentphp 3 app  I made reference to original resource

<?php

namespace App\Filament\Resources\QuizCategoryResource\RelationManagers;

...
use Illuminate\Database\Eloquent\Builder;

class UserQuizRequestsRelationManager extends RelationManager
{
    protected static string $relationship = 'userQuizRequests';

    public function infolist(Infolist $infolist): Infolist
    {
        return UserQuizRequestResource::infolist($infolist);
    }

    public function table(Table $table): Table
    {
        return UserQuizRequestResource::table($table);
    }
}

in UserQuizRequestResource I can use hiddenOn methos for components :

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('quizCategory.name')->sortable()->searchable()->hiddenOn(UserQuizRequestsRelationManager::class),

But when I tried to use such method for Actions like :

      Tables\Actions\EditAction::make()->iconButton()->hiddenOn(UserQuizRequestsRelationManager::class),

I got error :

      Method Filament\Tables\Actions\EditAction::hiddenOn does not exist.

I tried to use visible method :

        Tables\Actions\EditAction::make()->iconButton()->visible(UserQuizRequestsRelationManager::class),

In this case I not not got error, but always is always visible.

If there is a way to hide action on condition somewhow ?

0 likes
1 reply

Please or to participate in this conversation.