abschlussprojekt-device-man.../device-app/app/Http/Controllers/OwnerTransactionController.php
2023-03-31 10:52:12 +02:00

50 lines
1.0 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\OwnerTransaction;
use Illuminate\Http\Request;
class OwnerTransactionController extends Controller
{
public function create()
{
return view('owners.create');
}
public function store(Request $request)
{
$formFields = $request->validate([
'rz_username' => 'required',
'timestamp_owner_since' => 'required'
]);
OwnerTransaction::create($formFields);
return redirect('/');
}
public function edit(OwnerTransaction $owner)
{
return view('owners.edit', ['owner' => $owner]);
}
public function update(OwnerTransaction $owner, Request $request)
{
$formFields = $request->validate([
'rz_username' => 'required',
'timestamp_owner_since' => 'required'
]);
$owner->update($formFields);
return back();
}
public function destroy(OwnerTransaction $owner)
{
$owner->delete();
return back();
}
}