fetchProfile(); } public function fetchProfile() { try { $response = Http::post('https://api.example.com/adminProfile'); if ($response->successful()) { $this->userInfo = $response->json()['data'] ?? null; } else { $this->alert('error', 'Failed to fetch profile data.', ['duration' => 20000]); $this->userInfo = null; } } catch (\Exception $e) { $this->alert('error', 'An error occurred: ' . $e->getMessage(), ['duration' => 20000]); $this->userInfo = null; } } public function getRoleLabel($role) { if ($role == '1') { return 'System Admin'; } elseif ($role == '3') { return 'Super Admin'; } return 'Marketing Personnel'; } public function render() { return view('livewire.my-profile.my-profile-view')->layout('layouts.app', ['title' => 'My Profile']); } }