Commit f75532dc authored by Mahmoud Aglan's avatar Mahmoud Aglan

Fix branch code overflow in setup wizard (varchar(10) limit)

Str::slug on Arabic names can produce codes longer than 10 chars.
Added Str::limit(..., 10, '') to truncate. Also removed navigate:true
from redirects to avoid Livewire SPA issues between layouts.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent eb13944c
...@@ -68,7 +68,7 @@ public function mount(): void ...@@ -68,7 +68,7 @@ public function mount(): void
// Check if setup already completed // Check if setup already completed
$settingsService = app(SettingsService::class); $settingsService = app(SettingsService::class);
if ($settingsService->get('setup_completed', false)) { if ($settingsService->get('setup_completed', false)) {
$this->redirect(route('dashboard'), navigate: true); $this->redirect(route('dashboard'));
return; return;
} }
...@@ -363,7 +363,7 @@ public function completeSetup(): void ...@@ -363,7 +363,7 @@ public function completeSetup(): void
'phone' => $branchData['phone'] ?? null, 'phone' => $branchData['phone'] ?? null,
'is_main' => $branchData['is_main'] ?? false, 'is_main' => $branchData['is_main'] ?? false,
'is_active' => true, 'is_active' => true,
'code' => Str::upper(Str::slug($branchData['name_ar'], '')), 'code' => Str::upper(Str::limit(Str::slug($branchData['name_ar'], ''), 10, '')),
]); ]);
} }
...@@ -459,7 +459,7 @@ public function completeSetup(): void ...@@ -459,7 +459,7 @@ public function completeSetup(): void
}); });
session()->flash('success', __('تم إعداد النظام بنجاح! مرحباً بك في الكابتن')); session()->flash('success', __('تم إعداد النظام بنجاح! مرحباً بك في الكابتن'));
$this->redirect(route('dashboard'), navigate: true); $this->redirect(route('dashboard'));
} }
// ─── Helpers ───────────────────────────────────────────────── // ─── Helpers ─────────────────────────────────────────────────
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment