1
0
mirror of https://koodu.h-i.works/projects/thebadspace synced 2025-06-25 16:04:37 -05:00

consolidated getLocation function

changed the function that retrieves a single location to decide what to
get based on the variable type, so it doesn't need to be two seperate
functions
This commit is contained in:
ro
2024-02-16 15:34:09 -06:00
parent 021a43f36a
commit 9d750fd76f
3 changed files with 13 additions and 7 deletions

View File

@ -3,17 +3,19 @@
namespace App\Services;
use App\Models\Location;
use App\Repositories\LocationRepository;
use App\Models\Source;
use Ramsey\Uuid\Uuid;
class UpdateService
{
protected $model;
private $limit = 15;
protected $model;
protected $locationRepository;
public function __construct(Location $model)
public function __construct(LocationRepository $locationRepository)
{
$this->model = $model;
$this->locationRepository = $locationRepository;
}
public function locations()
@ -126,7 +128,7 @@ class UpdateService
//once the unified list is created, update current entries or create fresh ones
foreach ($unified as $item) {
$location = Location::where("url", $item['url'])->first();
$location = $this->locationRepository->getLocation($item['url']);
if ($location) {
++$duplicates;
//update block count for existing item