diff --git a/device-app/app/Http/Controllers/PurchasingInformationController.php b/device-app/app/Http/Controllers/PurchasingInformationController.php index ead94c3..0602f3b 100644 --- a/device-app/app/Http/Controllers/PurchasingInformationController.php +++ b/device-app/app/Http/Controllers/PurchasingInformationController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\Device; use App\Models\PurchasingInformation; use Illuminate\Http\Request; @@ -26,12 +27,12 @@ public function store(Request $request) return redirect('/'); } - public function edit(PurchasingInformation $purchasing) + public function edit(Device $device) { - return view('purchasings.edit', ['purchasing' => $purchasing]); + return view('purchasings.edit', ['purchasing' => $device->purchasing]); } - public function update(PurchasingInformation $purchasing, Request $request) + public function update(Device $device, Request $request) { $formFields = $request->validate([ 'price' => 'required', @@ -40,9 +41,9 @@ public function update(PurchasingInformation $purchasing, Request $request) 'cost_centre' => 'required', ]); - $purchasing->update($formFields); + $device->purchasing->update($formFields); - return back(); + return redirect('/'); } public function destroy(PurchasingInformation $purchasing) diff --git a/device-app/resources/views/devices/create.blade.php b/device-app/resources/views/devices/create.blade.php index ac3b96f..428d877 100644 --- a/device-app/resources/views/devices/create.blade.php +++ b/device-app/resources/views/devices/create.blade.php @@ -11,43 +11,43 @@
- @error('device_id') + @error('title')

{{$message}}

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

{{$message}}

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

{{$message}}

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

{{$message}}

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

{{$message}}

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

{{$message}}

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

{{$message}}

@enderror
diff --git a/device-app/resources/views/purchasings/edit.blade.php b/device-app/resources/views/purchasings/edit.blade.php new file mode 100644 index 0000000..762a3af --- /dev/null +++ b/device-app/resources/views/purchasings/edit.blade.php @@ -0,0 +1,37 @@ +

{{ $purchasing->price }}

+
+ @method('PUT') + @csrf + + + @error('price') +

{{ $message }}

+ @enderror +
+ + + @error('timestamp_warranty_end') +

{{ $message }}

+ @enderror +
+ + + @error('timestamp_purchase') +

{{ $message }}

+ @enderror +
+ + + @error('cost_centre') +

{{ $message }}

+ @enderror +
+ + + @error('seller') +

{{ $message }}

+ @enderror + +