Код: Выделить всё
$data['requested_units'] = RequestedUnit::with([
'user',
'agent_warrants' => function ($q) {
$q->where('type', RequestedUnit::AgentSecurityWarrant);
}
])
->where('status', RequestedGrant::REQUESTED)
->get();
Подробнее здесь: https://stackoverflow.com/questions/785 ... main-table