Hi there.
Here is my code:
$personelList = App::make('MedPersonel')
->with( array('servicePrices' => function($query){
$query->selectRaw('ARRAY_AGG(med_service_id) AS med_service_id, ARRAY_AGG(med_service_price) AS med_service_price');
$query->groupBy('med_facility_id');
}))
->with('specialization')
->limit(1)
->get()->toArray()
;
Problem is that $personelList[0]['service_prices'] is an empty array. But when i do it this way:
$personelList = App::make('MedPersonel')
->with( array('servicePrices' => function($query){ }))
->with('specialization')
->limit(1)
->get()->toArray()
;
$personelList[0]['service_prices'] - contains elements.
Why? I check db log and there is a proper query to get service prices from database in both cases.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community