Routing
Routing with Orchestra Platform is still based on Laravel routing engine. However we include two base method for registering routes; Foundation::namespaced()
and Foundation::group()
.
Frontend Routing
Anything other than Orchestra Platform administration routes are considered as frontend routing, this includes routing to frontend for app and extensions. For this you can use the default frontend routes file available from routes/frontend.php
.
<?php
use Illuminate\Routing\Router;
$router->resources('photos', 'PhotoController', ['only' => ['index', 'show']]);
The main different is that we now include a namespace and a fallback prefix before providing any attributes for our route group. In this case app
is our route namespace and /
is the fallback prefix URL if app path is not registered.
The reason namespace is important because using this concept we can set an anchor to the URL via the following:
<a href="{{ handles('app::photos') }}">List Photos</a>
Backend Routing
You can easily create a new page for Orchestra Platform administration routes by using the default routes/backend.php
.
<?php
use Illuminate\Routing\Router;
$router->resource('photos', 'PhotoController');
Above code improves the basic Route::group()
by adding few things:
- Set the proper prefix or domain path for Orchestra Platform administration page.
- Add Orchestra\Foundation\Http\Middleware\UseBackendTheme middleware.
- Add route group namespace to App\Http\Controllers\Admin.
Behind the scene
It's actually an alias of
Foundation::group()
with additional configuration.
Generating URL
In order to make the routing configurable we have merged route()
, action()
and url()
to a single Foundation::handles()
method.
Updated less than a minute ago