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