Move email/ resources to mail/, added invoice generated email to admin, updated email template
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
use App\Models\{Invoice,Site};
|
||||
@@ -15,7 +14,9 @@ class InvoiceEmail extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'invoice:email {site} {id}';
|
||||
protected $signature = 'invoice:email'
|
||||
.' {--s|site : Site ID}'
|
||||
.' {id?}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -31,21 +32,23 @@ class InvoiceEmail extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Config::set('site',Site::findOrFail($this->argument('site')));
|
||||
Config::set(
|
||||
'site',
|
||||
$this->option('site')
|
||||
? Site::findOrFail($this->option('site'))
|
||||
: Site::where('url',config('app.url'))->sole()
|
||||
);
|
||||
|
||||
$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->send();
|
||||
$o->save();
|
||||
|
||||
} catch (\Exception $e) {
|
||||
dd($e);
|
||||
}
|
||||
|
||||
dump($result->getDebug());
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user