Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[5.7] Prevent unnecessary relationship queries #26992
Prevents unnecessary queries when lazy loading empty relationships:
(new Post(['user_id' => null]))->user; // null (new User)->posts; // 
This does not apply to custom relationship queries like
I don't think we need additional tests for this. There are plenty of tests that verify relationship queries.