You can convert Eloquent Collections back to a Query Builder instance

You can convert Eloquent Collections back to a Query Builder instance

A tiny tip about #laravel eloquent.

To retrieve the Query Builder after filtering the results: you can use ->toQuery().

The method internally use the first model of the collection and a whereKey comparison on the Collection models.

We're writing a book, you can get it for free here.