Implement Keystone environment deployments
This commit is contained in:
29
app/Http/Controllers/EnvironmentDeploymentController.php
Normal file
29
app/Http/Controllers/EnvironmentDeploymentController.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Jobs\Environments\DeployEnvironment;
|
||||
use App\Models\Application;
|
||||
use App\Models\Environment;
|
||||
use App\Models\Organisation;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class EnvironmentDeploymentController extends Controller
|
||||
{
|
||||
public function store(Organisation $organisation, Application $application, Environment $environment): RedirectResponse
|
||||
{
|
||||
abort_unless(
|
||||
(int) $application->organisation_id === (int) $organisation->id
|
||||
&& (int) $environment->application_id === (int) $application->id,
|
||||
404,
|
||||
);
|
||||
|
||||
dispatch(new DeployEnvironment($environment));
|
||||
|
||||
return redirect()->route('environments.show', [
|
||||
'organisation' => $organisation->id,
|
||||
'application' => $application->id,
|
||||
'environment' => $environment->id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user