Files
Motula-Translate-Backend/routes/web.php
2024-02-06 18:52:27 +01:00

64 lines
1.7 KiB
PHP

<?php
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\WordsController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::prefix('test')->group(function () {
Route::get('/{name?}', function (?string $name = null) {
return $name ?? 'niente';
})->whereAlpha('name');
Route::get('/{number}', function (int $number = null) {
return $number;
})->whereNumber('number');
});
Route::get('/pippo', function (Request $request) {
return response()->json([
'name' => 'Abigail',
'state' => 'CA',
]);
});
Route::view('/prova','test')->name('prova');
Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
Route::middleware('auth')->group(function () {
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});
Route::prefix('words')->group(function () {
Route::get('/', [WordsController::class, 'index'])->name('words.index');
Route::post('/', [WordsController::class, 'store'])->name('words.insert');
});
require __DIR__ . '/auth.php';