if you try user() (instead of user), it just gives an intelliphense error, but works? if so, keep it like that and ignore the intelliphense error. or use the user() from Auth facade: Auth::user()->can(...) (dont forget to use Illuminate\Support\Facades\Auth)
Getting error Undefined property: Illuminate\Auth\AuthManager::$user
Hello,
I am pretty new here and to Laravel. I am using filament panels and also using FullCalendar by saade. I am also using Filament Shield for permissions.
The issue is, in the calendar (also having this issue with hiding menu items) I want to hide the create appointment button unless the user is a specific role, or has a specific permission.
I have researched heavily but keep hitting the brick wall of this error. The offending code:
return [ Actions\CreateAction::make() ->visible(fn(): bool => auth()->user->can('create_appointments')), ];
I have also tried user() and that gives an intelliphense error. I am at a bit of a loss, as based on my research this seems to be the best way to achieve this.
I feel this is a simple issue with my lack of knowledge, but if anyone can point me in the right direction I would truly appreciate it!
Thanks Phil
Please or to participate in this conversation.