© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
Finn

Enable relational manager table actions based on a policy

I have a policy for my notes table (which is only accessible through a different resource's relational manager) where I want to allow a record to be updated or deleted only by users that have authorization via said policy. Does anyone know how I can go about doing this?

NotePolicy.php
<?php

namespace App\Policies;

use App\Models\Note;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class NotePolicy
{
    use HandlesAuthorization;

    public function update(User $user, Note $note): bool
    {
        return $user->id === $note->user_id;
    }

    public function delete(User $user, Note $note): bool
    {
        return $user->id === $note->user_id;
    }

}
<?php

namespace App\Policies;

use App\Models\Note;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class NotePolicy
{
    use HandlesAuthorization;

    public function update(User $user, Note $note): bool
    {
        return $user->id === $note->user_id;
    }

    public function delete(User $user, Note $note): bool
    {
        return $user->id === $note->user_id;
    }

}


NotesRelationalManager.php (current, non-working attempt)
...

  ->actions([
    Tables\Actions\ViewAction::make(),
    Tables\Actions\EditAction::make()
      ->visible(auth()->user()->can('update', $this)),
    Tables\Actions\DeleteAction::make()
      ->visible(auth()->user()->can('update', $this)),
  ])
...
...

  ->actions([
    Tables\Actions\ViewAction::make(),
    Tables\Actions\EditAction::make()
      ->visible(auth()->user()->can('update', $this)),
    Tables\Actions\DeleteAction::make()
      ->visible(auth()->user()->can('update', $this)),
  ])
...
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to create a dynamic table actions based on record ?
FilamentFFilament / ❓┊help
3y ago
Placeholder on relational table columns
FilamentFFilament / ❓┊help
3y ago
Table Actions on Columns
FilamentFFilament / ❓┊help
2y ago
Table actions on demand
FilamentFFilament / ❓┊help
3y ago