filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.52k stars 2.89k forks source link

edit in policy does not work #822

Closed rabol closed 2 years ago

rabol commented 2 years ago

Package

filament/filament

Package Version

v2.5.14

Laravel Version

v8.75

Livewire Version

v2.8.2

PHP Version

v8.0.13

Bug description

Documentation say that edit() control if a resource can be edited, but in fact it is update(). https://filamentadmin.com/docs/2.x/admin/resources#authorization

if one have a edit like this:

public function edit(User $user, Country $country)
    {
        if($country->short_code == 'es')
            return false;

        return true;
    }

one can edit the record, but this works

public function update(User $user, Country $country)
    {   
        if($country->short_code == 'es')
            return false;

        return true;
    }

Steps to reproduce

create an edit method in a policy an observe that it does not have any effect

Relevant log output

No response

danharrin commented 2 years ago

All good, this was fixed in the docs a few days ago but I need to redeploy the site. Thanks.