clients table updated

This commit is contained in:
Thekindbull 2025-11-09 15:58:58 +08:00
parent 76293fa453
commit b61f246b51
3 changed files with 6 additions and 5 deletions

View File

@ -50,8 +50,8 @@ public function getDeals()
{
$deals = Deal::where('agent_id', $agent->id);
}
$deals = $deals->pluck('id');
$clients = Client::join('deal_clients', 'users.id', '=', 'deal_clients.client_id')
->whereIn('users.id', function ($query) use ($deals)
{
@ -62,7 +62,7 @@ public function getDeals()
->orderBy('deal_clients.id', 'desc')
->with('deals');
;
$clients = $clients->select('users.*');
$clients = $clients->orderBy('name');
return $clients;
}
@ -70,6 +70,7 @@ public function getDeals()
function getClients()
{
$clients = $this->getDeals();
if ($this->status && $this->status == DealStatus::UNIQUE)
{
$clients = $clients->whereHas('deals', function ($query)
@ -88,7 +89,6 @@ function getClients()
}
else
{
/*$deals = $deals->orderBy('id', 'desc')->paginate($this->count, ['*'], 'all_clients');*/
$clients = $clients->paginate($this->count, ['*'], 'all_clients');
}
return $clients;

View File

@ -22,7 +22,7 @@ public function deals()
,
DealClients::class
,
'client_id'
''
,
'id'
,
@ -30,7 +30,6 @@ public function deals()
,
'deal_id'
);
}
public function dealsWithContracts()
{

View File

@ -10,7 +10,9 @@
$complexesNames = [];
$filterRow = [];
$clientDeals = $client->deals;
//echo 'cId:' . $client->id;
foreach ($clientDeals as $deal) {
//echo 'dId:' . $deal->id;
$filterRow[] = 'filter[deal_id][]=' . $deal->id;
$complexesNames[] = $deal->complex->name;
}