How can I use ids in laravel eager posts ?
$stocks = WsStock::select([
'id',
'industryIndex',
'nameFA',
DB::raw('count(industryIndex) as total'),
DB::raw('GROUP_CONCAT( id SEPARATOR ",") as ids')
])
->with([
'posts' => function ($query) use ($userId) {
/* is here ids ???? */
$query->whereUserId($userId);
$query->where('ppa', '!=', null);
},
'indice' => function ($query) use ($userId) {}
])
->whereHas('posts', function ($query) use ($userId) {
/* is here ids ???? */
$query->whereUserId($userId);
$query->where('ppa', '!=', null);
})
->groupBy('industryIndex')->get();
in code must one result for post. please help
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LoOknl
via IFTTT
Aucun commentaire:
Enregistrer un commentaire