validate([ 'price' => 'required', 'timestamp_warranty_end' => 'required', 'timestamp_purchase' => 'required', 'cost_centre' => 'required', ]); PurchasingInformation::create($formFields); return redirect('/'); } public function edit(Device $device) { return view('purchasings.edit', ['purchasing' => $device->purchasing]); } public function update(Device $device, Request $request) { $formFields = $request->validate([ 'price' => 'required', 'timestamp_warranty_end' => 'required', 'timestamp_purchase' => 'required', 'cost_centre' => 'required', ]); $device->purchasing->update($formFields); return redirect('/'); } public function destroy(PurchasingInformation $purchasing) { $purchasing->delete(); return back(); } }