2017-06-14 23:53:24 -05:00
|
|
|
<?php
|
|
|
|
|
2017-09-15 00:16:03 -05:00
|
|
|
namespace Pterodactyl\Services\Locations;
|
2017-06-14 23:53:24 -05:00
|
|
|
|
2022-10-14 10:59:20 -06:00
|
|
|
use Pterodactyl\Models\Location;
|
2017-07-02 21:29:58 -05:00
|
|
|
use Pterodactyl\Contracts\Repository\LocationRepositoryInterface;
|
2017-06-14 23:53:24 -05:00
|
|
|
|
2017-09-15 00:16:03 -05:00
|
|
|
class LocationCreationService
|
2017-06-14 23:53:24 -05:00
|
|
|
{
|
|
|
|
/**
|
2017-09-15 00:16:03 -05:00
|
|
|
* LocationCreationService constructor.
|
2017-06-14 23:53:24 -05:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function __construct(protected LocationRepositoryInterface $repository)
|
2017-06-14 23:53:24 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-09-15 00:16:03 -05:00
|
|
|
* Create a new location.
|
2017-06-14 23:53:24 -05:00
|
|
|
*
|
2017-06-24 19:49:09 -05:00
|
|
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
2017-06-14 23:53:24 -05:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function handle(array $data): Location
|
2017-06-14 23:53:24 -05:00
|
|
|
{
|
2017-07-02 21:29:58 -05:00
|
|
|
return $this->repository->create($data);
|
2017-06-14 23:53:24 -05:00
|
|
|
}
|
|
|
|
}
|