File: D:/HostingSpaces/stafa/stafa.nl/app/Komma/Departments/DepartmentRoutes.php
<?php
namespace App\Komma\Departments;
use App\Komma\Departments\Models\Department;
use App\Komma\Pages\Kms\PageController as KmsPageController;
use Illuminate\Support\Facades\Route;
use App\Komma\Departments\Kms\DepartmentController as KmsDepartmentController;
final class DepartmentRoutes
{
/**
* Route that are resolved from the Alias route to Rest Route by the AliasMiddleware.
* Through the controller the models will be bind by Implicit Route Model Binding,
* so no need to add Route::model in here.
*/
public static function web(){
Route::resource('departments', DepartmentController::class, [
'only' => [
'index',
'show'
]
]);
}
/**
* Routes that are used for and within the KMS
* Will be prefixed with 'kms' by the Route::group in the RouteResolver
*
* Note: Within the group we use the Explicit Route Model Binding to point to a Department
* This is because we use a global controller to resolve the model
*/
public static function kms(){
Route::model('department', Department::class); //Explicit route model binding
Route::resource('departments', KmsDepartmentController::class);
Route::get('api/departments', KmsDepartmentController::class.'@getStructureAsJson');
Route::post('api/departments', KmsDepartmentController::class.'@setStructureAsJson');
}
}