* Add test call to test notification #675 * Fix queue driver with emails not sending; formatting #675
This commit is contained in:
parent
69fb5a537e
commit
1054d53826
@ -7,6 +7,7 @@ use App\Models\Acars;
|
|||||||
use App\Models\Airline;
|
use App\Models\Airline;
|
||||||
use App\Models\Pirep;
|
use App\Models\Pirep;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Notifications\Messages\UserRegistered;
|
||||||
use App\Repositories\AcarsRepository;
|
use App\Repositories\AcarsRepository;
|
||||||
use App\Services\AirportService;
|
use App\Services\AirportService;
|
||||||
use App\Services\AwardService;
|
use App\Services\AwardService;
|
||||||
@ -60,6 +61,7 @@ class DevCommands extends Command
|
|||||||
'metar' => 'getMetar',
|
'metar' => 'getMetar',
|
||||||
'recalculate-stats' => 'recalculateStats',
|
'recalculate-stats' => 'recalculateStats',
|
||||||
'reset-install' => 'resetInstall',
|
'reset-install' => 'resetInstall',
|
||||||
|
'new-user-email' => 'newUserEmail',
|
||||||
'xml-to-yaml' => 'xmlToYaml',
|
'xml-to-yaml' => 'xmlToYaml',
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -290,6 +292,16 @@ class DevCommands extends Command
|
|||||||
$this->info('Done!');
|
$this->info('Done!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test sending a user a registered email
|
||||||
|
*/
|
||||||
|
protected function newUserEmail()
|
||||||
|
{
|
||||||
|
$user_id = $this->argument('param');
|
||||||
|
$user = User::find($user_id);
|
||||||
|
$user->notify(new UserRegistered($user));
|
||||||
|
}
|
||||||
|
|
||||||
public function liveFlights(): void
|
public function liveFlights(): void
|
||||||
{
|
{
|
||||||
$acarsRepo = app(AcarsRepository::class);
|
$acarsRepo = app(AcarsRepository::class);
|
||||||
|
@ -20,7 +20,7 @@ class BaseNotification extends Notification implements ShouldQueue
|
|||||||
$klass = get_class($this);
|
$klass = get_class($this);
|
||||||
$notif_config = config('notifications.channels', []);
|
$notif_config = config('notifications.channels', []);
|
||||||
if (!array_key_exists($klass, $notif_config)) {
|
if (!array_key_exists($klass, $notif_config)) {
|
||||||
Log::error('Notification type '.$klass.' missing from notifications config');
|
Log::error('Notification type '.$klass.' missing from notifications config, defaulting to mail');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ use Illuminate\Notifications\Messages\MailMessage;
|
|||||||
|
|
||||||
trait MailChannel
|
trait MailChannel
|
||||||
{
|
{
|
||||||
private $mailSubject;
|
protected $mailSubject;
|
||||||
private $mailTemplate;
|
protected $mailTemplate;
|
||||||
private $mailTemplateArgs;
|
protected $mailTemplateArgs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the arguments for the toMail() method
|
* Set the arguments for the toMail() method
|
||||||
|
@ -10,6 +10,8 @@ class AdminUserRegistered extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,8 @@ class NewsAdded extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $news;
|
private $news;
|
||||||
|
|
||||||
public function __construct(News $news)
|
public function __construct(News $news)
|
||||||
|
@ -13,6 +13,8 @@ class PirepAccepted extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $pirep;
|
private $pirep;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,8 @@ class PirepRejected extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $pirep;
|
private $pirep;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,8 @@ class PirepSubmitted extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $pirep;
|
private $pirep;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,8 @@ class UserPending extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,6 +19,8 @@ class UserPending extends BaseNotification
|
|||||||
*/
|
*/
|
||||||
public function __construct(User $user)
|
public function __construct(User $user)
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
$this->setMailable(
|
$this->setMailable(
|
||||||
|
@ -10,6 +10,8 @@ class UserRegistered extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,6 +10,8 @@ class UserRejected extends BaseNotification
|
|||||||
{
|
{
|
||||||
use MailChannel;
|
use MailChannel;
|
||||||
|
|
||||||
|
public $channels = ['mail'];
|
||||||
|
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -14,7 +14,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('QUEUE_DRIVER', 'database'),
|
'default' => env('QUEUE_DRIVER', 'sync'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -5,14 +5,13 @@ namespace Modules\Importer\Services;
|
|||||||
use App\Services\Installer\LoggerTrait;
|
use App\Services\Installer\LoggerTrait;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Modules\Importer\Utils\IdMapper;
|
use Modules\Importer\Utils\IdMapper;
|
||||||
use Modules\Importer\Utils\ImporterDB;
|
use Modules\Importer\Utils\ImporterDB;
|
||||||
|
|
||||||
abstract class BaseImporter implements ShouldQueue
|
abstract class BaseImporter
|
||||||
{
|
{
|
||||||
use LoggerTrait;
|
use LoggerTrait;
|
||||||
use Dispatchable;
|
use Dispatchable;
|
||||||
|
@ -2,10 +2,8 @@
|
|||||||
|
|
||||||
namespace $NAMESPACE$;
|
namespace $NAMESPACE$;
|
||||||
|
|
||||||
use Illuminate\Bus\Queueable;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class $CLASS$
|
* Class $CLASS$
|
||||||
@ -13,7 +11,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||||||
*/
|
*/
|
||||||
class $CLASS$ extends Mailable
|
class $CLASS$ extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
|
Loading…
Reference in New Issue
Block a user