46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Pterodactyl - Panel
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
|
*
|
|
* This software is licensed under the terms of the MIT license.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
namespace Pterodactyl\Services\Locations;
|
|
|
|
use Pterodactyl\Models\Location;
|
|
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
|
|
|
class LocationUpdateService
|
|
{
|
|
/**
|
|
* @var \Pterodactyl\Contracts\Repository\LocationRepositoryInterface
|
|
*/
|
|
protected $repository;
|
|
|
|
/**
|
|
* LocationUpdateService constructor.
|
|
*/
|
|
public function __construct(LocationRepositoryInterface $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
/**
|
|
* Update an existing location.
|
|
*
|
|
* @param int|\Pterodactyl\Models\Location $location
|
|
*
|
|
* @return \Pterodactyl\Models\Location
|
|
*
|
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
*/
|
|
public function handle($location, array $data)
|
|
{
|
|
$location = ($location instanceof Location) ? $location->id : $location;
|
|
|
|
return $this->repository->update($location, $data);
|
|
}
|
|
}
|