I have the following code in Request class to check if the user is authorized to perform update.
HandlesAuthorization trait
, by default gives default message. Is there any way to return customized message? I saw the authorize method in Request class
can return boolean
value only.
class UpdateRoleRequest extends Request
{
private $UserPermissionsSession;
public function __construct(IRole $Role) {
$this->UserPermissionsSession = new UserPermissionsSession();
}
public function authorize() {
$UserID = \Auth::user()->UserID;
return $this->UserPermissionsSession->CheckPermissionExists($UserID);
}
}