Routes
Introduction
Your app can register routes in Strata when you register your app.
Registering routes
Routes are best defined in it's own file, usually within a /routes directory.
Here you can define your routes just like you would with any other Laravel application. Then when you're
registering your app in your ServiceProvider you can also register any routes files you might have.
Usually you would create a separate file for frontend and backend routes.
1return $app 2 // ...3 ->frontendRoutes(__DIR__.'/../routes/frontend.php') 4 ->backendRoutes(__DIR__.'/../routes/backend.php');
Backend routes will be prefix with
adminand namedlego.They will also havewebandauthmiddleware applied.
Frontend route will just have thewebmiddleware applied.
Hiding routes for inactive apps
It's a good idea and best pratice to not make your routes accessible if the app has not been enabled.
This is best accomplished in your routes file via middleware enabled. The enabled middleware require one
parameter, which is the fully qualified namespaced name of the settings class for your app.
Example, if you settings class is Astrogoat\Shopify\Settings\ShopifySettings yo would use enabled:Astrogoat\Shopify\Settings\ShopifySettings.
1Route::group([2 'middleware' => ['enabled:Astrogoat\Shopify\Settings\ShopifySettings'] 3], function () {4 Route::get('/', [ProductsController::class, 'index'])->name('index');5});
More info on general middleware use in the Laravel docs: https://laravel.com/docs/8.x/middleware#assigning-middleware-to-routes