abschlussprojekt-device-man.../device-app/routes/web.php

33 lines
816 B
PHP
Raw Normal View History

2023-03-21 19:54:30 +01:00
<?php
use Illuminate\Support\Facades\Route;
2023-03-23 21:50:31 +01:00
use App\Models\Device;
2023-03-21 19:54:30 +01:00
/*
|--------------------------------------------------------------------------
| 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 view('welcome');
});
2023-03-23 12:25:56 +01:00
Route::get('/devices', function () {
2023-03-23 21:50:31 +01:00
//return view('deviceList');
return view('deviceList', [
'devices' => Device::all()
]);
2023-03-23 12:25:56 +01:00
});
2023-03-24 13:49:09 +01:00
Route::get('/devices/{device_id}', function ($device_id) {
2023-03-23 21:50:31 +01:00
return view('deviceDetail', [
2023-03-24 13:49:09 +01:00
'device' => Device::find($device_id)
2023-03-23 21:50:31 +01:00
]);
2023-03-23 12:25:56 +01:00
});