livewire clients form updated

This commit is contained in:
Thekindbull 2025-06-11 11:37:05 +08:00
parent 517957ca5b
commit 6f63bd9118

View File

@ -44,8 +44,7 @@ protected function rules()
}
public function mount()
{
$userBroker = Agent::where('user_id', auth()->user()->id)->first();
$this->complexes = Complex::where('city_id', $userBroker->company->city_id)->get();
$agent = Agent::where('user_id', auth()->user()->id)->first();
$this->client = [
'firstName' => '',
'secondName' => '',
@ -53,13 +52,21 @@ public function mount()
'complexId' => ''
];
$this->status = self::NEW;
if ($agent = Agent::where('user_id', auth()->user()->id)->first())
if ($agent)
{
$this->agent = $agent->id;
$this->complexes = Complex::where('city_id', $agent->company->city_id)->get();
}
else
{
$this->agent = false;
$admin = CompanyAdmin::where('user_id', auth()->user()->id)->first();
if ($admin)
{
$this->complexes = Complex::where('city_id', $admin->company_id)->get();
}
}
}
public function update()