33 lines
793 B
PHP
33 lines
793 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\Device;
|
|
use App\Models\PurchasingInformation;
|
|
use Illuminate\Http\Request;
|
|
|
|
class PurchasingInformationController extends Controller
|
|
{
|
|
|
|
public function edit(Device $device)
|
|
{
|
|
$this->authorize('admin-only');
|
|
return view('purchasings.edit', ['purchasing' => $device->purchasing]);
|
|
}
|
|
|
|
public function update(Device $device, Request $request)
|
|
{
|
|
$this->authorize('admin-only');
|
|
$formFields = $request->validate([
|
|
'price' => 'required',
|
|
'timestamp_warranty_end' => 'required',
|
|
'timestamp_purchase' => 'required',
|
|
'cost_centre' => 'required',
|
|
]);
|
|
|
|
$device->purchasing->update($formFields);
|
|
|
|
return redirect('/');
|
|
}
|
|
}
|