Add the ability to create mounts
This commit is contained in:
parent
a750362e5a
commit
a4af8ec977
6 changed files with 167 additions and 5 deletions
|
@ -1,26 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Admin\Mounts;
|
||||
namespace Pterodactyl\Http\Controllers\Admin;
|
||||
|
||||
use Prologue\Alerts\AlertsMessageBag;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Http\Requests\Admin\MountFormRequest;
|
||||
use Pterodactyl\Repositories\Eloquent\MountRepository;
|
||||
use Pterodactyl\Services\Mounts\MountCreationService;
|
||||
|
||||
class MountController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \Prologue\Alerts\AlertsMessageBag
|
||||
*/
|
||||
protected $alert;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Repositories\Eloquent\MountRepository
|
||||
*/
|
||||
protected $repository;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Locations\LocationCreationService
|
||||
*/
|
||||
protected $creationService;
|
||||
|
||||
/**
|
||||
* MountController constructor.
|
||||
*
|
||||
* @param \Prologue\Alerts\AlertsMessageBag $alert
|
||||
* @param \Pterodactyl\Repositories\Eloquent\MountRepository $repository
|
||||
* @param \Pterodactyl\Services\Mounts\MountCreationService $creationService
|
||||
*/
|
||||
public function __construct(
|
||||
MountRepository $repository
|
||||
AlertsMessageBag $alert,
|
||||
MountRepository $repository,
|
||||
MountCreationService $creationService
|
||||
) {
|
||||
$this->alert = $alert;
|
||||
$this->repository = $repository;
|
||||
$this->creationService = $creationService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,4 +53,21 @@ class MountController extends Controller
|
|||
'mounts' => $this->repository->getAllWithDetails(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle request to create new mount.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Admin\MountFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function create(MountFormRequest $request)
|
||||
{
|
||||
$mount = $this->creationService->handle($request->normalize());
|
||||
$this->alert->success('Mount was created successfully.')->flash();
|
||||
|
||||
//return redirect()->route('admin.mounts.view', $mount->id);
|
||||
return redirect()->route('admin.mounts');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue