I am building a system where the user creates a project and then the project has pages and routes.
I am working out the URL structure now and in Laravel is there a good way with middle ware to get the project information. Here's what I am thinking for the route structure:
{project}/
{project}/something
{project}/something/else
{project}/settings
Route::group
with a prefix seems like the best way to include all the middleware. Is there a way I can write a middleware class to check if the {project}
exists and then send the data to the view?
Route::group([
'prefix' => '{project}',
'middleware' => [
'auth',
'getprojectstuffandthings'
], ], function () {
// project routes
}
]);