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.'); } }