File: D:/HostingSpaces/farmfun/reserveren.farmfun.be/app/Komma/Pages/PageRoutes.php
<?php
namespace App\Komma\Pages;
use App\Komma\Pages\Kms\PageController as KmsPageController;
use App\Komma\Pages\Models\Page;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Route;
final class PageRoutes
{
/**
* 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::get('/pages/{page}', PageController::class . '@show');
Route::get('/wedstrijd/{antw}', PageController::class . '@contest');
Route::get('/toggle-maintenance-mode/{secret}', function ($secret) {
if ($secret !== 'finally-to-combell') {
abort(403);
}
$downFilePath = storage_path('framework/down');
if (File::exists($downFilePath)) {
File::delete($downFilePath);
return 'Application is now live.';
} else {
File::put($downFilePath, 'Down for maintenance');
return 'Application is now in maintenance mode.';
}
});
}
/**
* 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 Page
* This is because we use a global controller to resolve the model
*/
public static function kms()
{
Route::model('page', Page::class); //Explicit route model binding
Route::resource('{siteSlug}/pages', KmsPageController::class);
Route::get('api/{siteSlug}/pages', KmsPageController::class . '@getStructureAsJson');
Route::post('api/{siteSlug}/pages', KmsPageController::class . '@setStructureAsJson');
}
}