2017-06-15 05:53:24 +01:00
|
|
|
<?php
|
|
|
|
|
2017-09-15 06:16:03 +01:00
|
|
|
namespace Pterodactyl\Services\Locations;
|
2017-06-15 05:53:24 +01:00
|
|
|
|
2017-09-15 06:16:03 +01:00
|
|
|
use Pterodactyl\Models\Location;
|
2017-06-15 05:53:24 +01:00
|
|
|
|
2017-09-15 06:16:03 +01:00
|
|
|
class LocationUpdateService
|
2017-06-15 05:53:24 +01:00
|
|
|
{
|
|
|
|
/**
|
2017-09-15 06:16:03 +01:00
|
|
|
* Update an existing location.
|
2017-06-15 05:53:24 +01:00
|
|
|
*
|
|
|
|
*/
|
2022-10-14 17:59:20 +01:00
|
|
|
public function handle(Location|int $location, array $data): Location
|
2017-06-15 05:53:24 +01:00
|
|
|
{
|
2022-10-24 05:37:21 +01:00
|
|
|
/** @var Location $location */
|
|
|
|
if (is_int($location)) {
|
|
|
|
$location = Location::query()->findOrFail($location);
|
|
|
|
}
|
2017-06-15 05:53:24 +01:00
|
|
|
|
2022-10-24 05:37:21 +01:00
|
|
|
$location->update($data);
|
|
|
|
|
|
|
|
return $location;
|
2017-06-15 05:53:24 +01:00
|
|
|
}
|
|
|
|
}
|