<?php

namespace App\Http\Controllers;

use App\Services\UpdateService;

class LocationController extends Controller
{
    protected $update;

    public function __construct(UpdateService $updateService)
    {
        $this->update = $updateService;
    }

    public function updateLocations()
    {
        $result = $this->update->locations();

        return back()->with(
            'message',
            $result['duplicates'] .
            ' UPDATED - ' . $result['fresh'] .
            ' CREATED - ' . count($result['missing']) .
            ' SOURCE(S) NOT CHECKED'
        );
    }
}