2023-08-14 13:33:53 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2024-02-20 16:33:49 -06:00
|
|
|
use Illuminate\Http\Request;
|
2024-02-15 15:00:03 -06:00
|
|
|
use App\Services\UpdateService;
|
2024-02-20 16:33:49 -06:00
|
|
|
use App\Repositories\LocationRepository;
|
2023-08-14 13:33:53 -07:00
|
|
|
|
|
|
|
class LocationController extends Controller
|
|
|
|
{
|
2024-02-15 15:00:03 -06:00
|
|
|
protected $update;
|
2023-08-24 15:27:14 -07:00
|
|
|
|
2024-02-20 16:33:49 -06:00
|
|
|
public function __construct(
|
|
|
|
UpdateService $updateService,
|
|
|
|
LocationRepository $locationRepository
|
|
|
|
) {
|
|
|
|
$this->update = $updateService;
|
|
|
|
$this->location = $locationRepository;
|
2024-02-12 14:51:28 -06:00
|
|
|
}
|
|
|
|
|
2024-02-15 15:00:03 -06:00
|
|
|
public function updateLocations()
|
2024-02-12 14:51:28 -06:00
|
|
|
{
|
2024-02-17 19:33:35 -06:00
|
|
|
$result = $this->update->data();
|
2024-02-15 15:00:03 -06:00
|
|
|
|
|
|
|
return back()->with(
|
|
|
|
'message',
|
2024-02-17 19:33:35 -06:00
|
|
|
$result
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function compileLocations()
|
|
|
|
{
|
|
|
|
$result = $this->update->list();
|
|
|
|
|
|
|
|
return back()->with(
|
|
|
|
'message',
|
|
|
|
$result
|
2024-02-15 15:00:03 -06:00
|
|
|
);
|
2023-08-24 15:27:14 -07:00
|
|
|
}
|
2024-02-20 16:33:49 -06:00
|
|
|
|
|
|
|
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']);
|
|
|
|
}
|
|
|
|
}
|
2023-08-14 13:33:53 -07:00
|
|
|
}
|