Advertisement
Guest User

Untitled

a guest
Dec 18th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.32 KB | None | 0 0
  1. class Catalog extends Model
  2. {
  3.     protected $table = "catalog";  
  4.     public function items()
  5.     {
  6.         return $this->belongsToMany('App\Item','catalog_items')->select(['items.id','name'];
  7.     }
  8. }
  9.  
  10. $catalog = Catalog::where('url', '=', $param2)->with('items:items.id,name')->first();
  11.  
  12. $catalog->items()->paginate(4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement