From d81439a4f71575291fe6382eb6feda2fb06e46af Mon Sep 17 00:00:00 2001 From: TimmensOne Date: Fri, 24 Mar 2023 13:49:09 +0100 Subject: [PATCH] fix single device route --- README.md | 7 ++++++- device-app/app/Models/Device.php | 9 +++++++++ device-app/routes/web.php | 5 ++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7062429..7b43cde 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,9 @@ propably MIT latest: 15.04.2023 ## About -Laravel is a full feature framework \ No newline at end of file +Laravel is a full feature framework + +## Database setup + +### Data seed +sail exec laravel.test php artisan migrate:refresh --seed \ No newline at end of file diff --git a/device-app/app/Models/Device.php b/device-app/app/Models/Device.php index dfaa44d..8293e27 100644 --- a/device-app/app/Models/Device.php +++ b/device-app/app/Models/Device.php @@ -7,6 +7,15 @@ class Device extends Model { + /** + * Timestamps are disabled. + * @var boolean + */ public $timestamps = false; + /** + * The primary key associated with the table Devices. + * @var string + */ + protected $primaryKey = 'device_id'; use HasFactory; } \ No newline at end of file diff --git a/device-app/routes/web.php b/device-app/routes/web.php index 752a9d0..fda47db 100644 --- a/device-app/routes/web.php +++ b/device-app/routes/web.php @@ -21,13 +21,12 @@ Route::get('/devices', function () { //return view('deviceList'); return view('deviceList', [ - //'devices' => Device::all() 'devices' => Device::all() ]); }); -Route::get('/devices/{id}', function ($id) { +Route::get('/devices/{device_id}', function ($device_id) { return view('deviceDetail', [ - 'device' => Device::find($id) + 'device' => Device::find($device_id) ]); });