DEV Community

Discussion on: 6 useful tips to boost your Laravel code

Collapse
 
silidrone profile image
Silidrone • Edited

Thank you for the article, I really like the tips mentioned, especially the query scopes, which are a nice way to reduce repetition in Repositories for your app.
My eye just caught something while reading the article, shouldn't the filter method be used as (for filtering unpaid invoices in your example):
$activeInvoices = $invoices->filter(function ($invoice) {
return !$invoice->paid;
});

With the !

It seems weird that the condition in the closure for the reject and the filter function are the same.