From f39a0f944367cbb1f6ec8974f00a7e256c9d9491 Mon Sep 17 00:00:00 2001 From: TimmensOne Date: Sun, 26 Mar 2023 17:36:20 +0200 Subject: [PATCH] add device edit --- .../app/Http/Controllers/DeviceController.php | 4 ++ .../resources/views/devices/edit.blade.php | 57 +++++++++++++++++++ .../resources/views/devices/show.blade.php | 1 + device-app/routes/web.php | 2 + 4 files changed, 64 insertions(+) create mode 100644 device-app/resources/views/devices/edit.blade.php diff --git a/device-app/app/Http/Controllers/DeviceController.php b/device-app/app/Http/Controllers/DeviceController.php index 2a299f2..673ec71 100644 --- a/device-app/app/Http/Controllers/DeviceController.php +++ b/device-app/app/Http/Controllers/DeviceController.php @@ -37,6 +37,10 @@ public function store(Request $request){ return redirect('/devices'); } + public function edit(Device $device) { + return view('devices.edit', ['device' => $device]); + } + public function show(Device $device) { return view('devices.show', [ diff --git a/device-app/resources/views/devices/edit.blade.php b/device-app/resources/views/devices/edit.blade.php new file mode 100644 index 0000000..0acce54 --- /dev/null +++ b/device-app/resources/views/devices/edit.blade.php @@ -0,0 +1,57 @@ +@extends('layout') + +@section('content') +
+ @csrf + @method('PUT') + + + @error('device_id') +

{{$message}}

+ @enderror +
+ + + @error('device_id') +

{{$message}}

+ @enderror +
+ + + @error('device_id') +

{{$message}}

+ @enderror +
+ + + @error('device_id') +

{{$message}}

+ @enderror +
+ + + @error('device_id') +

{{$message}}

+ @enderror +
+ + + @error('device_id') +

{{$message}}

+ @enderror +
+ + + @error('device_id') +

{{$message}}

+ @enderror +
+ + + @error('device_id') +

{{$message}}

+ @enderror +
+ +
+@endsection \ No newline at end of file diff --git a/device-app/resources/views/devices/show.blade.php b/device-app/resources/views/devices/show.blade.php index dc468cd..b6713fe 100644 --- a/device-app/resources/views/devices/show.blade.php +++ b/device-app/resources/views/devices/show.blade.php @@ -12,4 +12,5 @@
  • {{ $device['serial_number'] }}
  • {{ $device['image_url'] }}
  • + @endsection diff --git a/device-app/routes/web.php b/device-app/routes/web.php index 905daee..471f73f 100644 --- a/device-app/routes/web.php +++ b/device-app/routes/web.php @@ -29,6 +29,8 @@ Route::post('/devices', [DeviceController::class, 'store']); // edit - show edit form +Route::get('devices/{device}/edit', [DeviceController::class, 'edit']); + // update - update device // destroy - delete device // show - show sigle device