Closed husseinelhussein closed 6 years ago
I think Voyager 1.0 only supported up to Laravel 5.5 so that means that you also upgraded Laravel version and you need to check: https://laravel.com/docs/5.6/upgrade I think your problem is in the Trusted Proxies section but better you check all doc.
@MrCrayon, did you reply to the correct issue....? You mention Voyager 1.0, Laravel 5.5, and TrustedProxies, but the issue mentions Voyager 1.1, Laravel 5.6, and UnauthorizedHttpException (a permissions error). Your comment doesn't seem relevant at all
@fletch3555 yes my reply was for this issue. In the title he said he upgraded to Voyager 1.1 meaning he had before Voyager 1.0. That also means, if I'm not mistaken, that he was using Laravel 5.5. That's why I suggested to check Laravel upgrade guide too.
Also googling for his error I found this one: https://github.com/laravel/framework/issues/23058
Edit: It's not the same error but that led me to the upgrade issue.
Digging a bit more on the specific error looks like null is not anymore valid as argument for the exception:
/** @deprecated */
public function canOrFail($permission)
{
if (!$this->can($permission)) {
throw new UnauthorizedHttpException(null);
}
return true;
}
That method is deprecated but is still used in VoyagerBreadContoller, VoyagerCompassController, VoyagerMediaController and VoyagerSettingsController.
Quick fix for @husseinelhussein you need to enable browse_bread permission to your user role after you add it to db.
P.S. Checking Laravel upgrade guide is still advised.
@MrCrayon i already saw that error too, and i fixed it by editing: App\Http\Middleware\TrustProxies.php
anyway, solution for the UnauthorizedHttpException
was simply adding relations between the permission and the role
permission_role
table and pointed the required permission to the role @husseinelhussein yes that solves the problem but Voyager code still needs to be fixed to not use null and also replace use of deprecated methods.
@fletch3555 what would be the correct replacement for this?
Voyager::canOrFail('browse_database');
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Description:
first of all thanks for this library it's really amazing work and saved me a lot of time. i tried to edit bread but got missing permission error, so i tried to add/edit
i see this error:
browse_bread
key topermissions
table now when i visit /admin/bread/Type error: Argument 1 passed to Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException::__construct() must be of the type string, null given, called in vendor\tcg\voyager\src\Voyager.php on line 245
Steps To Reproduce:
browse_bread
orbrowse_hooks
/admin/bread/<any_table>/edit
or/admin/hooks