abschlussprojekt-device-man.../device-app/routes/web.php
2023-03-31 10:52:12 +02:00

77 lines
3.5 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');
});
// Devices routes
// index - show all devices
Route::get('/devices', [DeviceController::class, 'index']);
// create - show device create form
Route::get('/devices/create', [DeviceController::class, 'create'])->middleware('auth');
// store - store new device
Route::post('/devices', [DeviceController::class, 'store'])->middleware('auth');
// Device purchasing routes
//Route::get('/devices/{device}/purchasing/create', [PurchasingInformationController::class, 'create']);
//Route::post('/devices/{device}/purchasing', [PurchasingInformationController::class, 'store']);
Route::get('/devices/{device}/purchasing/edit', [PurchasingInformationController::class, 'edit']);
Route::put('/devices/{device}/purchasing', [PurchasingInformationController::class, 'update']);
//Route::delete('/devices/{device}/purchasing', [PurchasingInformationController::class, 'destroy']);
// Device location routes
Route::get('/devices/{device}/locations/create', [LocationTransactionController::class, 'create']);
Route::post('/devices/{device}/locations', [LocationTransactionController::class, 'store']);
Route::get('/devices/locations/{location}/edit', [LocationTransactionController::class, 'edit']);
Route::put('/devices/locations/{location}', [LocationTransactionController::class, 'update']);
Route::delete('/devices/locations/{location}', [LocationTransactionController::class, 'destroy']);
// Device owner routes
Route::get('/devices/{device}/owners/create', [OwnerTransactionController::class, 'create']);
Route::post('/devices/{device}/owners', [OwnerTransactionController::class, 'store']);
Route::get('/devices/owners/{owner}/edit', [OwnerTransactionController::class, 'edit']);
Route::put('/devices/owners/{owner}', [OwnerTransactionController::class, 'update']);
Route::delete('/devices/owners/{owner}', [OwnerTransactionController::class, 'destroy']);
//
// edit - show edit form
Route::get('devices/{device}/edit', [DeviceController::class, 'edit'])->middleware('auth');
// update - update device
Route::put('devices/{device}', [DeviceController::class, 'update'])->middleware('auth');
// destroy - delete device
Route::delete('devices/{device}', [DeviceController::class, 'destroy'])->middleware('auth');
// show - show sigle device
Route::get('/devices/{device}', [DeviceController::class, 'show']);
//User routes
// create - show register form
Route::get('/register', [UserController::class, 'create']);
// store - store new user
Route::post('/users', [UserController::class, 'store']);
// login - show user login form
Route::get('/login', [UserController::class, 'login'])->name('login');
// authenticate - log in user
Route::post('/users/authenticate', [UserController::class, 'authenticate']);
// logout - log out user
Route::post('/logout', [UserController::class, 'logout']);