Enable email test

This commit is contained in:
Deon George 2022-06-13 20:55:39 +10:00
parent 642446e592
commit 8777024cd8
2 changed files with 6 additions and 4 deletions

View File

@ -50,7 +50,6 @@ class ServiceList extends Command
)); ));
foreach (Service::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->with(['site'])->cursor() as $o) { foreach (Service::withoutGlobalScope(\App\Models\Scopes\SiteScope::class)->with(['site'])->cursor() as $o) {
//dd($o,$o->site);
if ((! $this->option('inactive')) AND ! $o->isActive()) if ((! $this->option('inactive')) AND ! $o->isActive())
continue; continue;

View File

@ -3,10 +3,11 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use App\Mail\TestEmail as MailTest; use App\Mail\TestEmail as MailTest;
use App\Models\User; use App\Models\{Site,User};
class TestEmail extends Command class TestEmail extends Command
{ {
@ -15,7 +16,7 @@ class TestEmail extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'test:email {id}'; protected $signature = 'test:email {site : Site ID} {id : User ID} {email? : Alternative Email}';
/** /**
* The console command description. * The console command description.
@ -41,9 +42,11 @@ class TestEmail extends Command
*/ */
public function handle() public function handle()
{ {
Config::set('site',Site::findOrFail($this->argument('site')));
$uo = User::find($this->argument('id')); $uo = User::find($this->argument('id'));
Mail::to($uo->email) Mail::to($this->argument('email') ?? $uo->email)
->send(new MailTest($uo)); ->send(new MailTest($uo));
} }
} }