2023-03-21 19:54:30 +01:00
|
|
|
<?php
|
|
|
|
|
2023-03-25 11:02:47 +01:00
|
|
|
use App\Http\Controllers\DeviceController;
|
2023-03-31 10:52:12 +02:00
|
|
|
use App\Http\Controllers\LocationTransactionController;
|
|
|
|
use App\Http\Controllers\OwnerTransactionController;
|
|
|
|
use App\Http\Controllers\PurchasingInformationController;
|
2023-03-27 15:29:49 +02:00
|
|
|
use App\Http\Controllers\UserController;
|
2023-03-21 19:54:30 +01:00
|
|
|
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!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2023-03-31 10:52:12 +02:00
|
|
|
Route::get('/', function () {
|
|
|
|
return redirect('/home');
|
|
|
|
});
|
2023-03-27 15:29:49 +02:00
|
|
|
Route::get('/home', function () {
|
2023-03-21 19:54:30 +01:00
|
|
|
return view('welcome');
|
|
|
|
});
|
2023-03-23 12:25:56 +01:00
|
|
|
|
2023-03-31 10:52:12 +02:00
|
|
|
// Devices routes
|
2023-03-26 11:32:54 +02:00
|
|
|
// index - show all devices
|
2023-03-25 11:02:47 +01:00
|
|
|
Route::get('/devices', [DeviceController::class, 'index']);
|
2023-03-27 15:29:49 +02:00
|
|
|
// create - show device create form
|
2023-03-27 16:16:47 +02:00
|
|
|
Route::get('/devices/create', [DeviceController::class, 'create'])->middleware('auth');
|
2023-03-26 11:32:54 +02:00
|
|
|
// store - store new device
|
2023-03-27 16:16:47 +02:00
|
|
|
Route::post('/devices', [DeviceController::class, 'store'])->middleware('auth');
|
2023-03-31 10:52:12 +02:00
|
|
|
|
|
|
|
// 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']);
|
|
|
|
|
|
|
|
//
|
2023-03-26 11:32:54 +02:00
|
|
|
// edit - show edit form
|
2023-03-27 16:16:47 +02:00
|
|
|
Route::get('devices/{device}/edit', [DeviceController::class, 'edit'])->middleware('auth');
|
2023-03-26 11:32:54 +02:00
|
|
|
// update - update device
|
2023-03-27 16:16:47 +02:00
|
|
|
Route::put('devices/{device}', [DeviceController::class, 'update'])->middleware('auth');
|
2023-03-26 11:32:54 +02:00
|
|
|
// destroy - delete device
|
2023-03-27 16:16:47 +02:00
|
|
|
Route::delete('devices/{device}', [DeviceController::class, 'destroy'])->middleware('auth');
|
2023-03-26 11:32:54 +02:00
|
|
|
// show - show sigle device
|
2023-03-25 11:02:47 +01:00
|
|
|
Route::get('/devices/{device}', [DeviceController::class, 'show']);
|
2023-03-27 15:29:49 +02:00
|
|
|
|
2023-03-31 10:52:12 +02:00
|
|
|
//User routes
|
2023-03-27 15:29:49 +02:00
|
|
|
// 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
|
2023-03-27 16:16:47 +02:00
|
|
|
Route::get('/login', [UserController::class, 'login'])->name('login');
|
2023-03-27 15:29:49 +02:00
|
|
|
// authenticate - log in user
|
|
|
|
Route::post('/users/authenticate', [UserController::class, 'authenticate']);
|
2023-03-27 16:16:47 +02:00
|
|
|
// logout - log out user
|
2023-03-31 10:52:12 +02:00
|
|
|
Route::post('/logout', [UserController::class, 'logout']);
|