Get invoice in overdue and in reminders limit
This commit is contained in:
parent
dc7be8fc77
commit
2dd2bcdc57
|
|
@ -39,7 +39,7 @@ class InvoiceOverdueCron extends Command
|
|||
public function handle()
|
||||
{
|
||||
// Get 'overdue' invoices
|
||||
Invoice::whereOverdueReminders()
|
||||
Invoice::inOverdueAndRemindersLimit()
|
||||
->get()
|
||||
->each(function (Invoice $invoice) {
|
||||
$invoice->sendInvoiceReminder();
|
||||
|
|
|
|||
|
|
@ -57,8 +57,9 @@ trait InvoiceReminder
|
|||
/**
|
||||
* Scope a query to include only the overdue invoices and at the limit of reminders.
|
||||
*/
|
||||
public function scopeOverdueReminders($query)
|
||||
public function scopeInOverdueAndRemindersLimit($query)
|
||||
{
|
||||
$query->where('state', '=', 'overdue');
|
||||
if ($this->hasOverdueRemindersLimit()) {
|
||||
$limit = $this->getOverdueRemindersLimit();
|
||||
return $query->where('reminders', '<', $limit);
|
||||
|
|
|
|||
Loading…
Reference in New Issue