eledana/routes/web.php

40 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2024-11-07 16:09:43 +00:00
<?php
use App\Http\Controllers\FaultController;
2024-11-07 16:09:43 +00:00
use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route;
2024-11-08 01:29:09 +00:00
use App\Models\User;
use App\Models\Fault;
2024-11-08 01:29:09 +00:00
2024-11-07 16:09:43 +00:00
Route::get('/', function () {
2024-11-07 16:47:14 +00:00
return view('home');
2024-11-07 16:09:43 +00:00
});
Route::get('/dashboard', function () {
2024-11-08 01:29:09 +00:00
$users = \App\Models\User::all();
return view('dashboard.index', compact('users'));
2024-11-07 16:09:43 +00:00
})->middleware(['auth', 'verified'])->name('dashboard');
2024-11-08 01:29:09 +00:00
// Subroute for users under /dashboard/users
Route::get('/dashboard/users', function () {
$users = \App\Models\User::all();
return view('dashboard.users', compact('users'));
})->name('dashboard.users');
Route::get('/dashboard/faults', [FaultController::class, 'index'])->name('dashboard.faults');
Route::get('/dashboard/faults/open-modal/{id}', [FaultController::class, 'openModal'])->name('dashboard.openModal');
Route::get('/dashboard/faults/close-modal', [FaultController::class, 'closeModal'])->name('dashboard.closeModal');
Route::patch('/dashboard/faults/{id}/update-status', [FaultController::class, 'updateStatus'])->name('dashboard.updateStatus');
2024-11-08 01:29:09 +00:00
2024-11-07 16:09:43 +00:00
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');
});
require __DIR__.'/auth.php';