Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Services/Locations/LocationUpdateService.php
10277 views
1
<?php
2
3
namespace Pterodactyl\Services\Locations;
4
5
use Pterodactyl\Models\Location;
6
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
7
8
class LocationUpdateService
9
{
10
/**
11
* LocationUpdateService constructor.
12
*/
13
public function __construct(protected LocationRepositoryInterface $repository)
14
{
15
}
16
17
/**
18
* Update an existing location.
19
*
20
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
21
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
22
*/
23
public function handle(Location|int $location, array $data): Location
24
{
25
$location = ($location instanceof Location) ? $location->id : $location;
26
27
return $this->repository->update($location, $data);
28
}
29
}
30
31