It would appear that there is no auth()->user() for some reason. What is a custom request; can you show the Route definition, attached middlewares?
Apr 4, 2021
3
Level 4
Custom request auth
In the User model I have a value isTeacher and in a custom request called ServiceProvider I am checking if the isTeacher in the user is set to 1. When accessing the user through auth()->user()->isTeacher an error is thrown saying its accessing null values so is there any special way to check for auth in custom requests?
Please or to participate in this conversation.