*/ public function rules(): array { return [ 'name' => 'required|string|max:255', 'type' => 'required|string|max:255|exclude', 'config' => 'array|exclude', ]; } public function asController(ActionRequest $request): void { $type = $request->input('type')::from($request->input('config')); if (!$type->check()) { throw ValidationException::withMessages(['type' => 'Verbindung fehlgeschlagen']); } Fileshare::create([ ...$request->validated(), 'type' => $type, ]); Succeeded::message('Verbindung erstellt.')->dispatch(); } }