I have two tables 'category' and 'items'. I would like to select five items from each category. I tried my code but it's not working. How can I do it in Laravel?
<?php
$items = DB::table('items')
    ->leftjoin('category', 'category.id', '=', 'items.categoryId')
    ->select('items.id', 'items.name', 'items.categoryId', 'category.categoryName')
    ->groupBy(items . categoryId)
    ->limit(5)
    ->get()
 
     
     
     
    