fix single device route

This commit is contained in:
TimmensOne 2023-03-24 13:49:09 +01:00
parent 0d22d49119
commit d81439a4f7
3 changed files with 17 additions and 4 deletions

View File

@ -23,4 +23,9 @@ propably MIT
latest: 15.04.2023 latest: 15.04.2023
## About ## About
Laravel is a full feature framework Laravel is a full feature framework
## Database setup
### Data seed
sail exec laravel.test php artisan migrate:refresh --seed

View File

@ -7,6 +7,15 @@
class Device extends Model class Device extends Model
{ {
/**
* Timestamps are disabled.
* @var boolean
*/
public $timestamps = false; public $timestamps = false;
/**
* The primary key associated with the table Devices.
* @var string
*/
protected $primaryKey = 'device_id';
use HasFactory; use HasFactory;
} }

View File

@ -21,13 +21,12 @@
Route::get('/devices', function () { Route::get('/devices', function () {
//return view('deviceList'); //return view('deviceList');
return view('deviceList', [ return view('deviceList', [
//'devices' => Device::all()
'devices' => Device::all() 'devices' => Device::all()
]); ]);
}); });
Route::get('/devices/{id}', function ($id) { Route::get('/devices/{device_id}', function ($device_id) {
return view('deviceDetail', [ return view('deviceDetail', [
'device' => Device::find($id) 'device' => Device::find($device_id)
]); ]);
}); });