While Laravel Debug Bar is an excellent tool for monitoring queries, it doesn't automatically identify N+1 query problems for you.
Fortunately, Laravel offers some automations in the newer versions.
Built-in Laravel N+1 Query Detection (Laravel 8.43+)
Starting with Laravel 8.43, the framework includes built-in functionality to detect and prevent N+1 query problems.
This feature works by disabling Lazy loading (the opposite of Eager loading) and throwing exceptions when it's attempted.
To enable this feature, add the following code to the boot method in your...
Am I correct in understanting that even having Model::automaticallyEagerLoadRelationships(); it still will be better to manually add with() to necessary queries? or it's OK to completely ignore(not add) with() at all in this case?
You are technically correct about this. The bad part is - there still might be some edge-cases where this doesn't work.
Personally, I'd suggest turning that on for the sake of protection (just in case), but still add them manually, since then you can control how much data you load. For example, if you have a table with 20 columns - it doens't make sense to always load them. Load only what's displayed on the page. In that case, manual control allows you to do that, while the automatic loading - will always load ALL data :)