init crater

This commit is contained in:
Mohit Panjwani
2019-11-11 12:16:00 +05:30
commit bdf2ba51d6
668 changed files with 158503 additions and 0 deletions

View File

@ -0,0 +1,50 @@
<?php
namespace Laraspace\Console\Commands;
use Illuminate\Console\Command;
use Carbon\Carbon;
use Laraspace\Invoice;
class CheckInvoiceStatus extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'check:invoices:status';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Check invoices status.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$date = Carbon::now();
$invoices = Invoice::where('status', '<>', Invoice::STATUS_COMPLETED)->whereDate('due_date', '<',$date)->get();
foreach ($invoices as $invoice) {
$invoice->status = Invoice::STATUS_OVERDUE;
printf("Invoice %s is OVERDUE \n", $invoice->invoice_number);
$invoice->save();
}
}
}