@deemoSep 01.2022 — #The difference between the has() and with() methods is that, has() simply checks if a relationship exists between 2 models whereas with() is used to eager-load the related eloquent model. // has - This will return all posts that have at least 1 comment
$posts = Post::query() ->has('comments') ->get();
// with - This will eager-load the comments and reduce the amount of queries
Post::with('comments')->get();
A benefit of eager-loading is simply reducing the amount of queries to return the parent model along with the relation model.