diff --git a/src/Mail/Jobs/Mail.php b/src/Mail/Jobs/Mail.php index 0bf6760d..7611a075 100644 --- a/src/Mail/Jobs/Mail.php +++ b/src/Mail/Jobs/Mail.php @@ -7,25 +7,26 @@ use Baka\Mail\Message; use Phalcon\Di; use Swift_Mailer; +use Swift_Message; use Swift_SmtpTransport; class Mail extends Job implements QueueableJobInterface { protected object $config; protected array $options; - protected Message $message; + protected Swift_Message $message; /** * Setup the mail job construct. * - * @param Message $message + * @param Swift_Message $message * @param array $options */ - public function __construct(Message $message, array $options = []) + public function __construct(Swift_Message $message, array $options = []) { $this->message = $message; - $this->config = $message->getManager()->getConfigure(); - $this->options = $options; + $this->config = $options['config']; + $this->options = $options['options']; } /** @@ -46,12 +47,12 @@ public function handle() $username = $auth['username']; $password = $auth['password']; - //ovewrite host + //overwrite host if (array_key_exists('host', $auth)) { $host = $auth['host']; } - //ovewrite port + //overwrite port if (array_key_exists('port', $auth)) { $port = $auth['port']; } @@ -65,7 +66,7 @@ public function handle() $swift = Swift_Mailer::newInstance($transport); $failures = []; - if ($swift->send($this->message->getMessage(), $failures)) { + if ($swift->send($this->message, $failures)) { Di::getDefault()->get('log')->info('Email successfully sent to', [$this->message->getTo()]); } else { Di::getDefault()->get('log')->error('Email error sending ', [$failures]); diff --git a/src/Mail/Message.php b/src/Mail/Message.php index 01e6848d..4269d678 100644 --- a/src/Mail/Message.php +++ b/src/Mail/Message.php @@ -74,7 +74,13 @@ public function send() $this->failedRecipients = []; $options = $this->auth ? ['auth' => $this->smtp] : []; - Mail::dispatch($this, $options); + Mail::dispatch( + $this->getMessage(), + [ + 'options' => $options, + 'config' => $this->getManager()->getConfigure() + ] + ); } /** diff --git a/storage/db/migrations/20190510224738_init_blameable.php b/storage/db/migrations/20190510224738_init_blameable.php index 5623fde3..253fb5d2 100644 --- a/storage/db/migrations/20190510224738_init_blameable.php +++ b/storage/db/migrations/20190510224738_init_blameable.php @@ -24,6 +24,7 @@ public function change() 'limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'identity' => 'enable', + 'precision' => '20', ]) ->addColumn('entity_id', 'string', [ 'null' => false, @@ -103,12 +104,14 @@ public function change() 'limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'identity' => 'enable', + 'precision' => '20', ]) ->addColumn('audits_id', 'biginteger', [ 'null' => false, 'limit' => MysqlAdapter::INT_BIG, 'signed' => false, 'after' => 'id', + 'precision' => '20', ]) ->addColumn('field_name', 'string', [ 'null' => false, diff --git a/storage/db/migrations/20200711231533_add_custom_fieldsv2.php b/storage/db/migrations/20200711231533_add_custom_fieldsv2.php index 5e95de89..bf2e5cf2 100644 --- a/storage/db/migrations/20200711231533_add_custom_fieldsv2.php +++ b/storage/db/migrations/20200711231533_add_custom_fieldsv2.php @@ -7,14 +7,14 @@ class AddCustomFieldsv2 extends Phinx\Migration\AbstractMigration public function change() { $this->table('audits_details', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_general_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) + 'id' => false, + 'primary_key' => ['id'], + 'engine' => 'InnoDB', + 'encoding' => 'utf8mb4', + 'collation' => 'utf8mb4_general_ci', + 'comment' => '', + 'row_format' => 'DYNAMIC', + ]) ->changeColumn('old_value', 'text', [ 'null' => true, 'limit' => 65535, @@ -46,14 +46,14 @@ public function change() ->save(); $this->table('leads', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) + 'id' => false, + 'primary_key' => ['id'], + 'engine' => 'InnoDB', + 'encoding' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'comment' => '', + 'row_format' => 'DYNAMIC', + ]) ->changeColumn('email', 'string', [ 'null' => true, 'limit' => 255, @@ -64,18 +64,19 @@ public function change() ->save(); $this->table('apps_custom_fields', [ - 'id' => false, - 'primary_key' => ['id'], - 'engine' => 'InnoDB', - 'encoding' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'comment' => '', - 'row_format' => 'DYNAMIC', - ]) + 'id' => false, + 'primary_key' => ['id'], + 'engine' => 'InnoDB', + 'encoding' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'comment' => '', + 'row_format' => 'DYNAMIC', + ]) ->addColumn('id', 'biginteger', [ 'null' => false, 'limit' => MysqlAdapter::INT_BIG, 'identity' => 'enable', + 'precision' => '20', ]) ->addColumn('companies_id', 'integer', [ 'null' => false, @@ -99,6 +100,7 @@ public function change() 'default' => '0', 'limit' => MysqlAdapter::INT_BIG, 'after' => 'model_name', + 'precision' => '20', ]) ->addColumn('name', 'string', [ 'null' => false,