53 lines
1 KiB
PHP
53 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
abstract class EmployeeInfo extends Mailable
|
|
{
|
|
use Queueable;
|
|
use SerializesModels;
|
|
|
|
protected $data;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function __construct(array $data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
|
|
/**
|
|
* Build the message.
|
|
*
|
|
* @return $this
|
|
*/
|
|
abstract public function build();
|
|
|
|
/**
|
|
* Attach a joined file if given in data
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function joinFileIfProvided(): void
|
|
{
|
|
if (isset($this->data['file'])) {
|
|
$joinedFileName = sprintf(
|
|
'PortEmployee-PJ-%s.%s',
|
|
date("YmdHis"),
|
|
$this->data['file']->extension()
|
|
);
|
|
$this->attach($this->data['file'], [
|
|
'as' => $joinedFileName,
|
|
'mime' => $this->data['file']->getMimeType()
|
|
]);
|
|
}
|
|
}
|
|
}
|