misc_pterodactyl-panel/app/Services/Locations/LocationUpdateService.php
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00

29 lines
766 B
PHP

<?php
namespace Pterodactyl\Services\Locations;
use Pterodactyl\Models\Location;
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
class LocationUpdateService
{
/**
* LocationUpdateService constructor.
*/
public function __construct(protected LocationRepositoryInterface $repository)
{
}
/**
* Update an existing location.
*
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle(Location|int $location, array $data): Location
{
$location = ($location instanceof Location) ? $location->id : $location;
return $this->repository->update($location, $data);
}
}