route('organisation')); return inertia('providers/Create', [ 'providerTypes' => array_values(ProviderType::toArray()), ]); } public function store(StoreProviderRequest $request): RedirectResponse { $organisation = Organisation::findOrFail($request->route('organisation')); $organisation->providers()->create([ 'name' => $request->string('name')->toString(), 'type' => $request->enum('type', ProviderType::class), 'token' => $request->string('token')->toString(), ]); return redirect() ->route('organisations.show', ['organisation' => $organisation->id]) ->with('success', 'Server provider created.'); } public function destroy(Request $request): RedirectResponse { $organisation = Organisation::findOrFail($request->route('organisation')); $provider = $organisation->providers()->findOrFail($request->route('provider')); $provider->delete(); return redirect() ->route('organisations.show', ['organisation' => $organisation->id]) ->with('success', 'Server provider deleted.'); } }