Mohamed shows how you can deal with N+1 problems using the $with model attribute and the newly added Model::preventLazyLoading() method.
PHP
#[RouteParameter] Does Not Bind Your Model
Michael Dyrynda explains a subtle Laravel gotcha: #[RouteParameter] only reads the current route parameter value, it does not perform implicit model binding. Good reminder that the controller signature still matters when you expect a bound Read more…