osb/app/Console/Commands/InvoiceEmail.php
Deon George d662328903
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 35s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s
Temporarily fix invoice emailing
2024-07-06 10:37:44 +10:00

51 lines
950 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Mail;
use Illuminate\Console\Command;
use App\Models\{Invoice,Site};
class InvoiceEmail extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'invoice:email {site} {id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Email Invoices to be client';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Config::set('site',Site::findOrFail($this->argument('site')));
$o = Invoice::findOrFail($this->argument('id'));
$result = Mail::to($o->account->user->email)->send(new \App\Mail\InvoiceEmail($o));
try {
$o->print_status = TRUE;
//$o->reminders = $o->reminders('send');
$o->save();
} catch (\Exception $e) {
dd($e);
}
dump($result->getDebug());
}
}