Files
faveo/app/Jobs/SendEmail.php
Shift 43386fd86d Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions.

You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root.

For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
2023-01-03 08:25:25 +00:00

53 lines
1.1 KiB
PHP

<?php
namespace App\Jobs;
use App\Http\Controllers\Common\PhpMailController;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class SendEmail extends Job implements ShouldQueue
{
use InteractsWithQueue;
use SerializesModels;
protected $from;
protected $to;
protected $message;
protected $template;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($from, $to, $message, $template_variables = '')
{
$this->from = $from;
$this->to = $to;
$this->message = $message;
$this->template = $template_variables;
}
/**
* Execute the job.
*
* @return void
*/
public function handle(PhpMailController $PhpMailController)
{
try {
$p = $PhpMailController->sendEmail($this->from, $this->to, $this->message, $this->template);
return $p;
} catch (\Exception $e) {
logger()->warning($e->getMessage());
session()->flash('fails', $e->getMessage());
}
}
}