user()->role != 1) { // $this->alert('error', 'Unauthorized access.'); // return redirect('/'); // } $this->fetchAccounts(); } public function fetchAccounts() { try { $response = Http::get('https://api.example.com/member', [ '_locked' => 1, '_sort_by' => 'card_number', '_sort_order' => 'asc', ]); if ($response->successful()) { $this->accounts = $response->json()['data'] ?? []; } else { $this->alert('error', 'Failed to fetch locked accounts.'); } } catch (\Exception $e) { $this->alert('error', 'An error occurred: ' . $e->getMessage()); } } public function render() { return view('livewire.member-management.lock-account-list')->layout('layouts.app', ['title' => 'Locked Accounts']); } }