@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | use Faker\Generator as Faker; |
| 3 | 3 | |
| 4 | -$factory->define(agoalofalife\postman\Models\SheduleEmail::class, function (Faker $faker) { |
|
| 4 | +$factory->define(agoalofalife\postman\Models\SheduleEmail::class, function(Faker $faker) { |
|
| 5 | 5 | return [ |
| 6 | 6 | 'date' => $faker->date('Y-m-d'), |
| 7 | 7 | 'email_id' => factory(agoalofalife\postman\Models\Email::class)->create()->id, |
@@ -17,10 +17,10 @@ |
||
| 17 | 17 | { |
| 18 | 18 | foreach (trans('postman::statuses') as $status) { |
| 19 | 19 | Status::firstOrCreate([ |
| 20 | - 'name' => $status['name'], |
|
| 21 | - 'description' => $status['description'], |
|
| 22 | - 'color_rgb' => $status['color_rgb'], |
|
| 23 | - Status::COLUMN_UNIQUE_NAME => $status['unique_name'], |
|
| 20 | + 'name' => $status[ 'name' ], |
|
| 21 | + 'description' => $status[ 'description' ], |
|
| 22 | + 'color_rgb' => $status[ 'color_rgb' ], |
|
| 23 | + Status::COLUMN_UNIQUE_NAME => $status[ 'unique_name' ], |
|
| 24 | 24 | ]); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -14,8 +14,8 @@ |
||
| 14 | 14 | { |
| 15 | 15 | public static function parse() : void |
| 16 | 16 | { |
| 17 | - SheduleEmail::whereRaw('CAST(date AS Datetime) <= ? AND status_id = ?', [Carbon::now(), Status::inProcess()])->get() |
|
| 18 | - ->each(function ($value) { |
|
| 17 | + SheduleEmail::whereRaw('CAST(date AS Datetime) <= ? AND status_id = ?', [ Carbon::now(), Status::inProcess() ])->get() |
|
| 18 | + ->each(function($value) { |
|
| 19 | 19 | $value->mode->owner->postEmail($value); |
| 20 | 20 | }); |
| 21 | 21 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | const DONE = 'done'; |
| 11 | 11 | const COLUMN_UNIQUE_NAME = 'unique_name'; |
| 12 | 12 | |
| 13 | - protected $fillable = ['name', 'description', 'color_rgb', self::COLUMN_UNIQUE_NAME]; |
|
| 13 | + protected $fillable = [ 'name', 'description', 'color_rgb', self::COLUMN_UNIQUE_NAME ]; |
|
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * Get id status "In process" |
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function postEmail(SheduleEmail $tasks) : void |
| 21 | 21 | { |
| 22 | - Mail::send('postman::email', ['html' => $tasks->email->text], function($message) use ($tasks) { |
|
| 22 | + Mail::send('postman::email', [ 'html' => $tasks->email->text ], function($message) use ($tasks) { |
|
| 23 | 23 | $message->subject($tasks->email->theme); |
| 24 | 24 | $message->from(config('mail.from.address')); |
| 25 | 25 | $message->to(config('mail.from.address')); |
| 26 | - $tasks->email->users->each(function ($value) use ($message) { |
|
| 26 | + $tasks->email->users->each(function($value) use ($message) { |
|
| 27 | 27 | $message->bcc($value->email); |
| 28 | 28 | }); |
| 29 | 29 | }); |
@@ -16,10 +16,10 @@ |
||
| 16 | 16 | public function postEmail(SheduleEmail $tasks) |
| 17 | 17 | { |
| 18 | 18 | $template = config('postman.templates.'.get_class($this)); |
| 19 | - Mail::send($template['name_template'], [$template['variable'] => $tasks->email->text], function($message) use ($tasks) { |
|
| 19 | + Mail::send($template[ 'name_template' ], [ $template[ 'variable' ] => $tasks->email->text ], function($message) use ($tasks) { |
|
| 20 | 20 | $message->subject($tasks->email->theme); |
| 21 | 21 | $message->from(config('mail.from.address')); |
| 22 | - $message->to($tasks->email->users->map(function($value){ return $value->email;})->toArray()); |
|
| 22 | + $message->to($tasks->email->users->map(function($value) { return $value->email; })->toArray()); |
|
| 23 | 23 | }); |
| 24 | 24 | |
| 25 | 25 | // if to reached the sender |