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