abschlussprojekt-device-man.../device-app/app/Http/Controllers/PurchasingInformationController.php
2023-04-04 15:52:47 +02:00

35 lines
858 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\Device;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
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);
Log::info('Purchasing Information updated successfully');
return redirect('/');
}
}