thebadspace/app/Http/Controllers/LocationController.php

52 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?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']);
}
}
}