Closed JeromeSiau closed 8 months ago
Hi,
I find out how to do it. Laraval is not able to auto-discover policies when it's in the vendor directory, so you just need to help Laravel by manually registering the policy in the App\Providers\AuthServiceProvider
class AuthServiceProvider extends ServiceProvider
{
/**
* The model to policy mappings for the application.
*
* @var array<class-string, class-string>
*/
protected $policies = [
'RickDBCN\FilamentEmail\Models\Email' => 'App\Policies\EmailPolicy',
];
...
This seems to have no effect on the menu item. I can't hide it with this method, and I don't use spatie roles on this project. Laravel: 10.48.20, Filament Email: v1.5.1
Alternative solution is to use the config and add a custom hasRole() method to your user model.
What happened?
I don't use Shield but I use very simple laravel policies
It seems my policy is ignored and I'm not sure how to fit it
How to reproduce the bug
It's the first time I'm trying to use a policy on a resource coming from a plugin so I might do something wrong
Package Version
1.0.10
PHP Version
8.2.14
Laravel Version
10.10
Which operating systems does with happen with?
macOS
Notes
No response