Replace location repository
This commit is contained in:
parent
860b2d890b
commit
126c9e940f
13 changed files with 33 additions and 154 deletions
|
@ -3,27 +3,17 @@
|
|||
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);
|
||||
return $location->update($data);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue