Is it faster to query everything in the controller and return every query back, or query in view as you use it?
Assuming all the models had the relationship
Example:
Do everythig in cotroller and then return
Public function articlesHome($id)
{
$art = Articles::find($id);
$cit = Articles::city();
$tag = Articles::tags();
Return view('articles', compact('art', 'tag', 'cit');
}
Or in view (after controller returned $article)
{{ $article->name }}
...
{{ $article->city->name }}
...
@foreach($article->tags as tag)
{{ tag->name }}
@endforeach
Which is best in practice and faster.