2020-05-21 00:55:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Services\Mounts;
|
|
|
|
|
|
|
|
use Ramsey\Uuid\Uuid;
|
|
|
|
use Pterodactyl\Repositories\Eloquent\MountRepository;
|
|
|
|
|
|
|
|
class MountCreationService
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var \Pterodactyl\Repositories\Eloquent\MountRepository
|
|
|
|
*/
|
|
|
|
protected $repository;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* MountCreationService constructor.
|
|
|
|
*
|
|
|
|
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $repository
|
|
|
|
*/
|
|
|
|
public function __construct(MountRepository $repository)
|
|
|
|
{
|
|
|
|
$this->repository = $repository;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new mount.
|
|
|
|
*
|
|
|
|
* @param array $data
|
|
|
|
* @return \Pterodactyl\Models\Mount
|
|
|
|
*
|
|
|
|
* @throws \Exception
|
|
|
|
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
|
|
*/
|
|
|
|
public function handle(array $data)
|
|
|
|
{
|
|
|
|
return $this->repository->create(array_merge($data, [
|
2020-05-21 01:11:20 +00:00
|
|
|
'uuid' => Uuid::uuid4()->toString(),
|
2020-05-21 00:55:59 +00:00
|
|
|
]), true, true);
|
|
|
|
}
|
|
|
|
}
|