Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PhillyD1973's avatar

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

0 likes
2 replies
s4muel's avatar
s4muel
Best Answer
Level 50

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)

PhillyD1973's avatar

Hey, thanks for the kind reply s4muel!

I did as you suggested and it worked perfectly! I guess Intelliphense was leading me astray!

Thanks again! :)

Phil

1 like

Please or to participate in this conversation.