50 lines
1.0 KiB
PHP
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();
|
|
}
|
|
}
|