Fix email generation and sending via CLI
This commit is contained in:
@@ -5,7 +5,7 @@ namespace App\Console\Commands;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
use App\Models\{Account,Invoice};
|
||||
use App\Models\{Account,Invoice,Site};
|
||||
|
||||
class InvoiceGenerate extends Command
|
||||
{
|
||||
@@ -14,7 +14,7 @@ class InvoiceGenerate extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'invoice:generate {account?} {--p|preview : Preview} {--l|list : List Items}';
|
||||
protected $signature = 'invoice:generate {site} {account?} {--p|preview : Preview} {--l|list : List Items}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -30,14 +30,14 @@ class InvoiceGenerate extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Config::set('site',Site::findOrFail($this->argument('site')));
|
||||
|
||||
if ($this->argument('account'))
|
||||
$accounts = collect()->push(Account::find($this->argument('account')));
|
||||
else
|
||||
$accounts = Account::active()->get();
|
||||
|
||||
foreach ($accounts as $o) {
|
||||
Config::set('site',$o->site);
|
||||
|
||||
$io = new Invoice;
|
||||
$io->account_id = $o->id;
|
||||
|
||||
|
Reference in New Issue
Block a user