Laravel $ user-> can(“…”)``抛出服务器错误500

I host a SPA with a Laravel API on AWS (EC2). When you fill out this form: (feel free to do so), the server throws an error with a response code of 500, right at the point where a $user->can("...") method is called. I developed the app localy and everything worked fine there.


Windows 10 / XAMPP-Apache 2.4.41 PHP 7.4.4 Laravel 7.5.2


Ubuntu 18.04 / Apache 2.4.29 PHP 7.4.6 Laravel 7.5.2

It uses spatie/laravel-permission for role management, which also affects the can method provided by the Laravel framework.


And here the error which I guess means, that the script failed as soon as if($user->can("...)) got called.