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{{$message}}
@enderror{{$message}}
@enderror{{$message}}
@enderror{{$message}}
@enderror{{$message}}
@enderror{{$message}}
@enderror{{ $purchasing->price }}
+