Files
ploi-core/routes/web.php
Ralph J. Smit 88b324b47a WIP
2022-07-26 21:32:56 +02:00

181 lines
10 KiB
PHP

<?php
use App\Http\Controllers\Auth\AuthenticateTwoFactorController;
use App\Http\Controllers\Profile\ProfileSecurityController;
use App\Http\Controllers\Profile\TwoFactorAuthentication\ConfirmTwoFactorAuthenticationController;
use App\Http\Controllers\Profile\TwoFactorAuthentication\RegenerateRecoveryCodesController;
use App\Http\Controllers\Profile\TwoFactorAuthentication\TwoFactorAuthenticationController;
use Illuminate\Support\Facades\Route;
Auth::routes();
Route::get('password-creation', 'Auth\CreatePasswordController@index')->name('password-creation')
->middleware(['signed', 'guest']);
Route::post('password-creation', 'Auth\CreatePasswordController@start')->name('password-creation.start')
->middleware('guest');
Route::get('installation-incomplete', 'PageController@installationIncomplete')->name('installation-incomplete');
Route::get('page/{slug}', 'PageController@show')->name('page.show');
// All auth protected routes
Route::group(['middleware' => ['auth', 'auth.blocked']], function () {
Route::get('confirm-2fa', [AuthenticateTwoFactorController::class, 'index'])->name('auth.confirm-2fa.index');
Route::post('confirm-2fa', [AuthenticateTwoFactorController::class, 'confirm'])->name('auth.confirm-2fa.confirm');
Route::middleware('auth.2fa')->group(function () {
Route::get('/', 'DashboardController@index')->name('dashboard');
Route::get('search', 'SearchController@handle')->name('search');
// Site routes
Route::group(['prefix' => 'sites', 'as' => 'sites.'], function () {
Route::get('/', 'SiteControl
ler@index')->name('index');
Route::get('{site}', 'SiteController@show')->name('show');
Route::delete('{site}', 'SiteController@destroy')->name('delete');
Route::post('/', 'SiteController@store')->name('store');
Route::post('{site}/request-ftp-password', 'SiteController@requestFtpPassword')->name('request-ftp-password');
Route::get('{site}/settings', 'SiteSettingController@show')->name('settings.show');
Route::patch('{site}/settings', 'SiteSettingController@update')->name('settings.update');
Route::patch('{site}/settings/php-version', 'SiteSettingController@changePhpVersion')->name('settings.php-version');
// Site apps
Route::group(['prefix' => '{site}/apps', 'as' => 'apps.'], function () {
Route::get('/', 'SiteAppController@index')->name('index');
Route::post('/', 'SiteAppController@store')->name('store');
Route::delete('/', 'SiteAppController@destroy')->name('delete');
});
// Site databases
Route::group(['prefix' => '{site}/databases', 'as' => 'databases.'], function () {
Route::get('/', 'SiteDatabaseController@index')->name('index');
Route::post('/', 'SiteDatabaseController@store')->name('store');
Route::delete('{database}', 'SiteDatabaseController@destroy')->name('delete');
});
// Site cronjobs
Route::group(['prefix' => '{site}/cronjobs', 'as' => 'cronjobs.'], function () {
Route::get('/', 'SiteCronjobController@index')->name('index');
Route::post('/', 'SiteCronjobController@store')->name('store');
Route::delete('{cronjob}', 'SiteCronjobController@destroy')->name('delete');
});
// Site redirects
Route::group(['prefix' => '{site}/redirects', 'as' => 'redirects.'], function () {
Route::get('/', 'SiteRedirectController@index')->name('index');
Route::post('/', 'SiteRedirectController@store')->name('store');
Route::delete('{redirect}', 'SiteRedirectController@destroy')->name('delete');
});
// Site SSL
Route::group(['prefix' => '{site}/certificates', 'as' => 'certificates.'], function () {
Route::get('/', 'SiteCertificateController@index')->name('index');
Route::post('/', 'SiteCertificateController@store')->name('store');
Route::delete('{certificate}', 'SiteCertificateController@destroy')->name('delete');
});
// Site aliases
Route::group(['prefix' => '{site}/aliases', 'as' => 'aliases.'], function () {
Route::get('/', 'SiteAliasController@index')->name('index');
Route::post('/', 'SiteAliasController@store')->name('store');
Route::delete('{alias}', 'SiteAliasController@destroy')->name('delete');
});
// Site DNS
Route::group(['prefix' => '{site}/dns', 'as' => 'dns.'], function () {
Route::get('/', 'SiteDnsController@index')->name('index');
Route::get('records', 'SiteDnsController@records')->name('records');
Route::post('/', 'SiteDnsController@store')->name('store');
Route::delete('{record}', 'SiteDnsController@destroy')->name('delete');
Route::put('{record}', 'SiteDnsController@update')->name('update');
});
});
// Server routes
Route::group(['prefix' => 'servers', 'as' => 'servers.', 'middleware' => 'has.access:servers'], function () {
Route::get('/', 'ServerController@index')->name('index');
Route::get('{provider}/plans-and-regions', 'ServerController@plansAndRegions')->name('plans-and-regions');
Route::get('{server}', 'ServerController@show')->name('show');
Route::get('{server}/settings', 'ServerController@show')->name('settings.show');
Route::patch('{server}/settings', 'ServerController@update')->name('settings.update');
Route::post('/', 'ServerController@store')->name('store');
Route::get('{server}/settings', 'ServerSettingController@show')->name('settings.show');
Route::delete('{server}', 'ServerController@destroy')->name('delete');
});
// Profile routes
Route::group(['prefix' => 'profile', 'as' => 'profile.', 'namespace' => 'Profile'], function () {
Route::get('/', 'ProfileController@index')->name('index');
Route::patch('/', 'ProfileController@update')->name('update');
Route::delete('destroy', 'ProfileController@destroy')->name('delete-account');
// Security
Route::group(['prefix' => 'security', 'as' => 'security.'], function () {
Route::get('/', [ProfileSecurityController::class, 'index'])->name('index');
Route::patch('/password', [ProfileSecurityController::class, 'updatePassword'])->name('updatePassword');
Route::group(['as' => 'two-factor-authentication.'], function () {
Route::put('2fa', [TwoFactorAuthenticationController::class, 'create'])->name('create');
Route::delete('2fa', [TwoFactorAuthenticationController::class, 'destroy'])->name('destroy');
Route::patch('2fa', ConfirmTwoFactorAuthenticationController::class)->name('confirm');
Route::patch('2fa/recovery-codes', RegenerateRecoveryCodesController::class)->name('regenerate-recovery-codes');
});
});
// Settings
Route::group(['prefix' => 'settings', 'as' => 'settings.'], function () {
Route::get('/', 'ProfileSettingController@index')->name('index');
Route::patch('/', 'ProfileSettingController@update')->name('update');
});
// Integrations
Route::group(['prefix' => 'integrations', 'as' => 'integrations.'], function () {
Route::get('/', 'ProfileIntegrationController@index')->name('index');
Route::post('/', 'ProfileIntegrationController@store')->name('store');
Route::delete('{provider}', 'ProfileIntegrationController@destroy')->name('destroy');
});
if (config('cashier.key') && config('cashier.secret')) {
Route::group(['prefix' => 'billing', 'as' => 'billing.'], function () {
Route::get('/', 'ProfileBillingController@index')->name('index');
Route::post('card/update', 'ProfileBillingController@updateCard')->name('update.card');
Route::delete('card', 'ProfileBillingController@deleteCard')->name('delete.card');
Route::post('plan/update', 'ProfileBillingController@updatePlan')->name('update.plan');
Route::delete('plan/cancel', 'ProfileBillingController@cancel')->name('cancel.plan');
Route::get('invoices', 'ProfileBillingController@invoices')->name('invoices');
Route::get('invoices/{id}/pdf', 'ProfileBillingController@pdf')->name('invoices.pdf');
});
}
Route::post('toggle-theme', 'ProfileController@toggleTheme')->name('toggle-theme');
Route::post('request-ftp-password', 'ProfileController@requestFtpPassword')->name('request-ftp-password');
});
// Support routes
if (setting('support')) {
Route::group(['prefix' => 'support', 'as' => 'support.'], function () {
Route::get('/', 'SupportController@index')->name('index');
Route::get('create', 'SupportController@create')->name('create');
Route::get('closed', 'SupportController@indexClosed')->name('index.closed');
Route::post('/', 'SupportController@store')->name('store');
Route::get('{support}', 'SupportController@show')->name('show');
Route::post('{support}/reply', 'SupportController@reply')->name('reply');
Route::post('{support}/close', 'SupportController@close')->name('close');
});
}
if (setting('documentation')) {
Route::group(['prefix' => 'documentation', 'as' => 'documentation.'], function () {
Route::get('/', 'DocumentationController@index')->name('index');
Route::get('{documentationCategory}', 'DocumentationController@show')->name('show');
Route::get('{documentationCategory}/article/{documentationItem}', 'DocumentationController@showArticle')->name('article.show');
});
}
});
});