Implement Keystone environment deployments
This commit is contained in:
41
app/Http/Controllers/RegistryController.php
Normal file
41
app/Http/Controllers/RegistryController.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\RegistryType;
|
||||
use App\Http\Requests\StoreRegistryRequest;
|
||||
use App\Models\Organisation;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Response;
|
||||
|
||||
class RegistryController extends Controller
|
||||
{
|
||||
public function create(Request $request): Response
|
||||
{
|
||||
Organisation::findOrFail($request->route('organisation'));
|
||||
|
||||
return inertia('registries/Create', [
|
||||
'registryTypes' => array_values(RegistryType::toArray()),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(StoreRegistryRequest $request): RedirectResponse
|
||||
{
|
||||
$organisation = Organisation::findOrFail($request->route('organisation'));
|
||||
|
||||
$organisation->registries()->create([
|
||||
'name' => $request->string('name')->toString(),
|
||||
'type' => $request->enum('type', RegistryType::class),
|
||||
'url' => rtrim($request->string('url')->toString(), '/'),
|
||||
'credentials' => [
|
||||
'username' => $request->string('username')->toString(),
|
||||
'password' => $request->string('password')->toString(),
|
||||
],
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
->route('organisations.show', ['organisation' => $organisation->id])
|
||||
->with('success', 'Registry created.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user