Implement Keystone environment deployments
This commit is contained in:
38
app/Http/Controllers/SourceProviderController.php
Normal file
38
app/Http/Controllers/SourceProviderController.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\SourceProviderType;
|
||||
use App\Http\Requests\StoreSourceProviderRequest;
|
||||
use App\Models\Organisation;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Response;
|
||||
|
||||
class SourceProviderController extends Controller
|
||||
{
|
||||
public function create(Request $request): Response
|
||||
{
|
||||
Organisation::findOrFail($request->route('organisation'));
|
||||
|
||||
return inertia('source-providers/Create', [
|
||||
'sourceProviderTypes' => array_values(SourceProviderType::toArray()),
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(StoreSourceProviderRequest $request): RedirectResponse
|
||||
{
|
||||
$organisation = Organisation::findOrFail($request->route('organisation'));
|
||||
|
||||
$organisation->sourceProviders()->create([
|
||||
'name' => $request->string('name')->toString(),
|
||||
'type' => $request->enum('type', SourceProviderType::class),
|
||||
'url' => $request->filled('url') ? rtrim($request->string('url')->toString(), '/') : null,
|
||||
'config' => [],
|
||||
]);
|
||||
|
||||
return redirect()
|
||||
->route('organisations.show', ['organisation' => $organisation->id])
|
||||
->with('success', 'Source provider created.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user