mercredi 20 juin 2018

when i use query builder in laravel

i have three tables users , posts and comment i want to get all posts and all comment for this posts when i use query builder join returned only posts that have a comment in comments table

enter code here $collection = DB::table('post')
        ->join('comment','post.id','comment.post_id')
        ->join('users','users.id','comment.commenter_id')
        ->orderBy('time', 'DESC')
        ->get()->all();

how can i return all posts or if you have another way to do it tell me pleas



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2lkkDIk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire