我需要重写函数
toArray()
public function toArray( $options = 0 )
{
if(!auth()->user()->hasPermissionTo('users.show.email')) {
$this->hidden[] = 'email';
}
// etc ...
return parent::toJson($options);
}
但是当我使用
User::Get()
[2019-04-06 23:18:33] local.ERROR: Maximum execution time of 60 seconds exceeded {"userId":1,"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Maximum execution time of 60 seconds exceeded at C:\\xampp\\htdocs\\starter\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Arr.php:162)
[stacktrace]
如果我不重写,一切都好
toArray()
功能。