ForRo/app/Http/Controllers/LocationController.php
ro 2a6b4b2c99 Location editing, part 1
The plumbing for editing location info has been updated, so that data
can be changed by authorized memebers. Also added a new data point for
locations to store archive links

part 2 will focus on setting up permissions and authorizations as well
as smoothing out adding new members and member roles. an edit link will
be added to locations, which will be visible for members with the
correct permissions
2024-02-20 16:33:49 -06:00

52 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Services\UpdateService;
use App\Repositories\LocationRepository;
class LocationController extends Controller
{
protected $update;
public function __construct(
UpdateService $updateService,
LocationRepository $locationRepository
) {
$this->update = $updateService;
$this->location = $locationRepository;
}
public function updateLocations()
{
$result = $this->update->data();
return back()->with(
'message',
$result
);
}
public function compileLocations()
{
$result = $this->update->list();
return back()->with(
'message',
$result
);
}
public function editLocation(Request $request)
{
$token = csrf_token();
$response = $this->location->editLocation($request);
if ($response['status']) {
return back()->with('message', $response['message']);
} else {
return back()->withErrors('message', $response['message']);
}
}
}