Illuminate\Auth\AuthManager" prop. missing

I’m trying to protect my profile edition page by using the following code:


However, I’m getting the following error:

undefined property: Illuminate\Auth\AuthManager::${“id":1,“name”:“mourad”,“surname”:“BENOSB”,“email”:"”,“email_verified_at”:null,“created_at”:“2020-01-04 11:41:28”,“updated_at”:“2020-01-04 11:41:28”}

The error is caused by a syntax error in the code. The correct syntax to access the currently authenticated user is auth()->user(), not auth()->$user. The correct code should be: