2021-05-20 23:54:07 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use App;
|
|
|
|
use App\Contracts\Command;
|
|
|
|
|
|
|
|
class EmailTest extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'phpvms:email-test';
|
|
|
|
protected $description = 'Send a test notification to admins';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run dev related commands
|
|
|
|
*
|
|
|
|
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2021-06-04 22:51:59 +08:00
|
|
|
/** @var App\Notifications\NotificationEventsHandler $eventHandler */
|
|
|
|
$eventHandler = app(App\Notifications\NotificationEventsHandler::class);
|
2021-05-20 23:54:07 +08:00
|
|
|
|
|
|
|
$news = new App\Models\News();
|
|
|
|
$news->user_id = 1;
|
|
|
|
$news->subject = 'Test News';
|
|
|
|
$news->body = 'Test Body';
|
|
|
|
$news->save();
|
|
|
|
|
|
|
|
$newsEvent = new App\Events\NewsAdded($news);
|
|
|
|
$eventHandler->onNewsAdded($newsEvent);
|
|
|
|
}
|
|
|
|
}
|