47 lines
1.8 KiB
PHP
47 lines
1.8 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\DeviceController;
|
|
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('/home', function () {
|
|
return view('welcome');
|
|
});
|
|
|
|
// 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');
|
|
// 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']);
|
|
|
|
// 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']);
|