RickDBCN / filament-email

Log emails in your Filament project
https://filament-email-demo.marcogermani.it/
MIT License
77 stars 23 forks source link

add possibility to show the menu item conditionally #41

Closed scaryGit closed 6 months ago

scaryGit commented 6 months ago

Is your feature request related to a problem? Please describe. I need to hide menu item for some users role

Describe the solution you'd like very basic solution I've found is to add canView method in EmailResource es: public static function canViewAny(): bool { return auth()->user()->{Config::get('filament-email.resource.canViewMethod')}(); } And in config add the name of the method 'resource' => [ ... 'canViewMethod' => 'isAdmin' ], in User model public function isAdmin(): bool { return $this->hasRole('Administrator'); } Thanks Cosimo

RickDBCN commented 6 months ago

That is correct. It should work now. You need to create the policies yourself, as it is too opinionated.

Does it work now?

tudorr89 commented 6 months ago

check https://github.com/RickDBCN/filament-email/issues/33, and use a policy