organizations->isOnboarded($request->user())) { return redirect()->route('qms.dashboard'); } $industries = []; foreach ($this->packages->all() as $package) { $industries[$package->key] = [ 'label' => $package->label(), 'description' => $package->description(), ]; } return view('qms.onboarding.show', [ 'user' => $request->user(), 'timezones' => timezone_identifiers_list(), 'industries' => $industries, 'appointmentModes' => config('qms.appointment_modes'), ]); } public function store(Request $request): RedirectResponse { if ($this->organizations->isOnboarded($request->user())) { return redirect()->route('qms.dashboard'); } $validated = $request->validate([ 'organization_name' => ['required', 'string', 'max:255'], 'industry' => ['required', 'string', 'in:'.implode(',', array_keys(config('industry_packages.packages', [])))], 'appointment_mode' => ['required', 'string', 'in:'.implode(',', array_keys(config('qms.appointment_modes')))], 'branch_name' => ['required', 'string', 'max:255'], 'branch_address' => ['nullable', 'string', 'max:500'], 'branch_phone' => ['nullable', 'string', 'max:50'], 'timezone' => ['required', 'timezone'], 'logo' => ['nullable', 'image', 'mimes:jpeg,png,jpg,webp,svg', 'max:2048'], ]); $organization = $this->organizations->completeOnboarding($request->user(), $validated); if ($request->hasFile('logo')) { $organization->update([ 'logo_path' => OrganizationBranding::storeLogo($organization, $request->file('logo')), ]); } $packageLabel = $this->packages->get($validated['industry'])?->label() ?? 'your industry'; return redirect()->route('qms.dashboard')->with( 'success', "Welcome to Ladill Queue — {$packageLabel} workflow provisioned." ); } }