Each Article belongs to many Categories. Each User has many Categories. I want to retrieve all the Articles which has the User’s Categories. For each of these relationships bel
You could use an IN query. Or a subquery.
Article::whereIn('id', $user->Categories::all->lists('id')->toArray() )
$category_id = $user->Categories::all->lists('id')->toArray();
Article::whereIn('id', function($query) use ($category_id){
$query->select('categories_id')
->from(with(new Category)->getTable())
->whereIn('category_id', $categoryID )
})->get();