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

I host a SPA with a Laravel API on AWS (EC2). When you fill out this form: http://ec2-52-59-214-55.eu-central-1.compute.amazonaws.com/register (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.

您知道如何解决该问题吗?

评论