abschlussprojekt-device-man.../device-app/routes/web.php
2023-03-31 17:17:09 +02:00

60 lines
3.2 KiB
PHP

<?php
use App\Http\Controllers\DeviceController;
use App\Http\Controllers\LocationTransactionController;
use App\Http\Controllers\OwnerTransactionController;
use App\Http\Controllers\PurchasingInformationController;
use App\Http\Controllers\UserController;
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 redirect('/home');
});
Route::get('/home', function () {
return view('welcome');
});
// Device purchasing routes
Route::get('/devices/{device}/purchasing/edit', [PurchasingInformationController::class, 'edit'])->middleware('auth');
Route::put('/devices/{device}/purchasing', [PurchasingInformationController::class, 'update'])->middleware('auth');
// Device location routes
Route::get('/devices/{device}/locations/create', [LocationTransactionController::class, 'create'])->middleware('auth');
Route::post('/devices/{device}/locations', [LocationTransactionController::class, 'store'])->middleware('auth');
Route::get('/devices/locations/{location}/edit', [LocationTransactionController::class, 'edit'])->middleware('auth');
Route::put('/devices/locations/{location}', [LocationTransactionController::class, 'update'])->middleware('auth');
Route::delete('/devices/locations/{location}', [LocationTransactionController::class, 'destroy'])->middleware('auth');
// Device owner routes
Route::get('/devices/{device}/owners/create', [OwnerTransactionController::class, 'create'])->middleware('auth');
Route::post('/devices/{device}/owners', [OwnerTransactionController::class, 'store'])->middleware('auth');
Route::get('/devices/owners/{owner}/edit', [OwnerTransactionController::class, 'edit'])->middleware('auth');
Route::put('/devices/owners/{owner}', [OwnerTransactionController::class, 'update'])->middleware('auth');
Route::delete('/devices/owners/{owner}', [OwnerTransactionController::class, 'destroy'])->middleware('auth');
// Devices routes
Route::get('/devices', [DeviceController::class, 'index'])->middleware('auth');
Route::get('/devices/create', [DeviceController::class, 'create'])->middleware('auth');
Route::post('/devices', [DeviceController::class, 'store'])->middleware('auth')->middleware('auth');
Route::get('devices/{device}/edit', [DeviceController::class, 'edit'])->middleware('auth');
Route::put('devices/{device}', [DeviceController::class, 'update'])->middleware('auth');
Route::delete('devices/{device}', [DeviceController::class, 'destroy'])->middleware('auth');
Route::get('/devices/{device}', [DeviceController::class, 'show'])->middleware('auth');
//User routes
Route::get('/register', [UserController::class, 'create']);
Route::post('/users', [UserController::class, 'store']);
Route::get('/login', [UserController::class, 'login'])->name('login');
Route::post('/users/authenticate', [UserController::class, 'authenticate']);
Route::post('/logout', [UserController::class, 'logout']);