Deploy Ladill Care / deploy (push) Failing after 13s
Healthcare management app: patients, appointments, consultations, lab, pharmacy inventory, billing, and reports at care.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
66 lines
2.2 KiB
PHP
66 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Care;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Care\Concerns\ScopesToAccount;
|
|
use App\Services\Care\OrganizationResolver;
|
|
use App\Support\OrganizationBranding;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class OnboardingController extends Controller
|
|
{
|
|
use ScopesToAccount;
|
|
|
|
public function __construct(
|
|
protected OrganizationResolver $organizations,
|
|
) {}
|
|
|
|
public function show(Request $request): View|RedirectResponse
|
|
{
|
|
if ($this->organizations->isOnboarded($request->user())) {
|
|
return redirect()->route('care.dashboard');
|
|
}
|
|
|
|
return view('care.onboarding.show', [
|
|
'user' => $request->user(),
|
|
'timezones' => timezone_identifiers_list(),
|
|
'facilityTypes' => [
|
|
'clinic' => 'Clinic',
|
|
'hospital' => 'Hospital',
|
|
'diagnostic' => 'Diagnostic laboratory',
|
|
'specialist' => 'Specialist practice',
|
|
],
|
|
]);
|
|
}
|
|
|
|
public function store(Request $request): RedirectResponse
|
|
{
|
|
if ($this->organizations->isOnboarded($request->user())) {
|
|
return redirect()->route('care.dashboard');
|
|
}
|
|
|
|
$validated = $request->validate([
|
|
'organization_name' => ['required', 'string', 'max:255'],
|
|
'facility_type' => ['required', 'string', 'in:clinic,hospital,diagnostic,specialist'],
|
|
'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')),
|
|
]);
|
|
}
|
|
|
|
return redirect()->route('care.dashboard')->with('success', 'Welcome to Ladill Care!');
|
|
}
|
|
}
|