I'm building this query
$mostPopularContent = DB::table('likes')
->select('id', 'content_moderated.text', 'content_moderated.author', DB::raw('COUNT(*) AS `like`'))
->leftJoin('content_moderated', 'likes.id_quote', '=', 'content_moderated.id')
->where('likes.id_quote', '!=', 0)
->groupBy('likes.id_quote')
->orderBy('like', 'desc')
->take(100)
->get();
I have a JSON output like this
[
{
id: "24603",
text: "Content",
author: null,
like: "34"
}
]
How can I cast id and like fields to integer ?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1X3NgYm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire