I have the following subquery on relation on my user model
User::select('account_id', 'username', 'firstname', 'lastname')->with([
'supplies' => function($query) use($year) {
return $query->select(
\DB::raw('month(from) as month'),
\DB::raw('count(supply.id) as hours_supply'),
\DB::raw('round(count(supply.id)/8,2) as days_supply')
)
->leftJoin('accounts', 'account_id', '=', 'employee')
->leftJoin('projects', 'projects.id', '=', 'projekt')
->whereYear('from', $year)
->whereIn('supply_status', [1, 2])
->groupBy(
'employee',
'username',
DB::raw('month(from)'))->get();
}]) ...
I use the debuger and I can map the query which executing manually returns values but on my user model would not reflect any collection
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2i5GGRr
via IFTTT
Aucun commentaire:
Enregistrer un commentaire