mdhub/app/application/routes/web.php

44 lines
3.0 KiB
PHP

<?php
use Illuminate\Support\Facades\Route;
Route::get('/', [\App\Http\Controllers\Site\RepositoriesController::class, 'repositories'])->name('home');
Route::get('user/{username}', [\App\Http\Controllers\Site\UserController::class, 'user'])->name('user.repositories');
Route::get('repository/{username}/{repository_name}', [\App\Http\Controllers\Site\RepositoriesController::class, 'repository'])->name('repository.view');
Route::get('repository/{username}/{repository_name}/tags', [\App\Http\Controllers\Site\TagRepositoriesController::class, 'tags'])->name('repository.tags');
Route::middleware('guest')->group(function () {
Route::get('login', [\App\Http\Controllers\AuthController::class, 'login'])->name('login');
Route::middleware(['throttle:login'])->post('login', [\App\Http\Controllers\AuthController::class, 'authorization'])->name('authorization');
});
Route::middleware(['auth', 'verified'])->group(function () {
Route::post('logout', [\App\Http\Controllers\AuthController::class, 'logout'])->name('logout');
});
Route::middleware(['web', 'auth', 'verified', \App\Http\Middleware\UserIsActive::class])
->group(function () {
Route::prefix('profile')->as('profile.')->group(function () {
Route::get('/', [\App\Http\Controllers\Site\ProfileController::class, 'profile'])->name('edit');
Route::put('/', [\App\Http\Controllers\Site\ProfileController::class, 'update'])->name('update');
Route::put('password', [\App\Http\Controllers\Site\ProfileController::class, 'updatePassword'])->name('update-password');
Route::get('settings', [\App\Http\Controllers\Site\ProfileController::class, 'settings'])->name('settings');
Route::put('settings', [\App\Http\Controllers\Site\ProfileController::class, 'updateSettings'])->name('update-settings');
Route::resource('access-tokens', \App\Http\Controllers\Site\AccessTokensController::class)->except(['show'])->where(['access_token' => '[0-9]+']);
});
Route::prefix('user/{username}')->group(function () {
Route::prefix('repository')->as('repository.')->group(function () {
Route::get('create', [\App\Http\Controllers\Site\RepositoriesController::class, 'create'])->name('create');
Route::post('/', [\App\Http\Controllers\Site\RepositoriesController::class, 'store'])->name('store');
Route::get('edit/{repository_name}', [\App\Http\Controllers\Site\RepositoriesController::class, 'edit'])->name('edit');
Route::put('edit/{repository_name}', [\App\Http\Controllers\Site\RepositoriesController::class, 'update'])->name('update');
Route::delete('{repository_name}', [\App\Http\Controllers\Site\RepositoriesController::class, 'destroy'])->name('destroy');
});
});
Route::delete('repository/{username}/{repository_name}/tag/{tag_id}', [\App\Http\Controllers\Site\TagRepositoriesController::class, 'destroy'])->name('repository.tag.destroy');
});