The Laravel team released Laravel 5.7.10 on 23 October 2018 with a handful of new features, fixes, and changes:
loadCount Eloquent Collection Method
First up, is the ability to load relationship counts on an Eloquent collection. Before this feature, you could only load relationships, but now you can call loadCount() to get counts for all relations.
The pull request illustrates how you could use loadCount() with the following example:
Now all the eventable models would have a count value for comments or hearts respectively. The loadCount feature was added by Tim MacDonald. Nice work Tim!
Pass a Model to assertSoftDeleted
You can use the assertSoftDeleted to assert that a model has been soft deleted. Before Laravel 5.7.10, the method call might look something like the following:
Now, thanks to an update to the assertSoftDeleted method, you can pass the model directly which will assert against the table’s primary key and primary key value:
Thanks to Dwight Watson for this nice shortcut!
Add Mock and Spy Objects to the Container
Titas Gailius added the ability to more conveniently add mock and spy instances to the container in a test:
These methods are syntactic sugar for something like the following:
André Filipe contributed a UUID validation method which uses a regex to avoid dependency of ramsey/uuid in the illuminate/validation component.
The name of the validation rule is uuid:
Notification Fake can Assert a Preferred Locale
Derek MacDonald added the ability to assert the preferred notification fake locale on notifications that implement the HasLocalePreference interface:
You can see the full diff between 5.7.9 and 5.7.10 on GitHub.