Closed ghost closed 6 years ago
just edit the url in the config file to the uri ex.admin/routes
where only admin or dev have access to it
@ctf0 How would you apply auth/admin checking middleware to that? I have middleware on anything admin/*
but it doesn't apply to /routes
since the package is just a custom middleware that displays a view directly.
@Braunson i also have the same
have u tried changing this to admin/routes
?
I've changed the middleware to a proper route now - reason why it was a middleware before was really for ease of installation and to ensure the route always works, as depending on the order you add the provider in your app.php
and what routes are enabled in your app, you may find your app's route overrides pretty routes one. But I've updated the readme instructions to highlight that. Shouldn't be too much of a problem now with autodiscovery.
Also there is a new middlewares
config option so you can enable certain middlewares, along with a debug_only
option in case you want to expose pretty routes on a production app but only to admins, etc.
Tagged as 1.0.0
@garygreen You are awesome! 🎉
Not sure why, but any time I added 'auth' to the 'middlewares' in the config/pretty-routes.php I would just get redirected to my app dashboard (actually to login first which would redirect to dashboard since already logged in). So my workaround was to add this to my routes/web.php:
Route::prefix('admin')->middleware(['web', 'auth', 'dev'])->group(function () {
Route::get('routes', '\PrettyRoutes\PrettyRoutesController@show');
});
And this to config/pretty-routes.php:
'url' => 'admin/routes',
The 'dev'
middleware is because I'm using Laravel Spark and that is how you only allow developers
I just want to be able to override the default route and wrap this in a route group so that only admin or dev roles can view the /routes page.