add components button
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\PurchasingInformation;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PurchasingInformationController extends Controller
|
||||
{
|
||||
public function create()
|
||||
{
|
||||
return view('purchasings.create');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$formFields = $request->validate([
|
||||
'price' => 'required',
|
||||
'timestamp_warranty_end' => 'required',
|
||||
'timestamp_purchase' => 'required',
|
||||
'cost_centre' => 'required',
|
||||
]);
|
||||
|
||||
PurchasingInformation::create($formFields);
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
public function edit(PurchasingInformation $purchasing)
|
||||
{
|
||||
return view('purchasings.edit', ['purchasing' => $purchasing]);
|
||||
}
|
||||
|
||||
public function update(PurchasingInformation $purchasing, Request $request)
|
||||
{
|
||||
$formFields = $request->validate([
|
||||
'price' => 'required',
|
||||
'timestamp_warranty_end' => 'required',
|
||||
'timestamp_purchase' => 'required',
|
||||
'cost_centre' => 'required',
|
||||
]);
|
||||
|
||||
$purchasing->update($formFields);
|
||||
|
||||
return back();
|
||||
}
|
||||
|
||||
public function destroy(PurchasingInformation $purchasing)
|
||||
{
|
||||
$purchasing->delete();
|
||||
return back();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user