How do we create a new Eloquent Collection in Laravel 4, without using Query Builder?
There is a newCollection()
method which can be overridden by that
I've actually found that using newCollection()
is more future proof....
Example:
$collection = (new Post)->newCollection();
That way, if you decide to create your own collection class for your model (like I have done several times) at a later stage, it's much easier to refactor your code, as you just override the newCollection()
function in your model