mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-23 09:32:29 +01:00
49 lines
1.3 KiB
PHP
49 lines
1.3 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.
|
|
*
|
|
* @param \Pterodactyl\Contracts\Repository\LocationRepositoryInterface $repository
|
|
*/
|
|
public function __construct(LocationRepositoryInterface $repository)
|
|
{
|
|
$this->repository = $repository;
|
|
}
|
|
|
|
/**
|
|
* Update an existing location.
|
|
*
|
|
* @param int|\Pterodactyl\Models\Location $location
|
|
* @param array $data
|
|
* @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);
|
|
}
|
|
}
|