@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | use Faker\Generator as Faker; |
| 3 | 3 | |
| 4 | -$factory->define(agoalofalife\postman\Models\EmailUser::class, function (Faker $faker) { |
|
| 4 | +$factory->define(agoalofalife\postman\Models\EmailUser::class, function(Faker $faker) { |
|
| 5 | 5 | return [ |
| 6 | 6 | 'email_id' => factory(agoalofalife\postman\Models\Email::class)->create()->id, |
| 7 | 7 | 'user_id' => factory(agoalofalife\postman\Models\User::class)->create()->id, |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | use Faker\Generator as Faker; |
| 3 | 3 | |
| 4 | -$factory->define(agoalofalife\postman\Models\ModePostEmail::class, function (Faker $faker) { |
|
| 4 | +$factory->define(agoalofalife\postman\Models\ModePostEmail::class, function(Faker $faker) { |
|
| 5 | 5 | return [ |
| 6 | 6 | 'name' => $faker->name, |
| 7 | 7 | 'description' => $faker->text, |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -$factory->define(agoalofalife\postman\Models\User::class, function (Faker $faker) { |
|
| 16 | +$factory->define(agoalofalife\postman\Models\User::class, function(Faker $faker) { |
|
| 17 | 17 | static $password; |
| 18 | 18 | |
| 19 | 19 | return [ |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Faker\Generator as Faker; |
| 4 | 4 | |
| 5 | -$factory->define(agoalofalife\postman\Models\Email::class, function (Faker $faker) { |
|
| 5 | +$factory->define(agoalofalife\postman\Models\Email::class, function(Faker $faker) { |
|
| 6 | 6 | return [ |
| 7 | 7 | 'theme' => $faker->text, |
| 8 | 8 | 'text' => $faker->text, |
@@ -1,11 +1,11 @@ |
||
| 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, |
| 8 | 8 | 'mode_id' => factory(agoalofalife\postman\Models\ModePostEmail::class)->create()->id, |
| 9 | - 'status_action' => $faker->randomElement([0,1]), |
|
| 9 | + 'status_action' => $faker->randomElement([ 0, 1 ]), |
|
| 10 | 10 | ]; |
| 11 | 11 | }); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function index() : Collection |
| 21 | 21 | { |
| 22 | - $preData = SheduleEmail::with(['email.users', 'mode'])->get()->map(function ($value) { |
|
| 22 | + $preData = SheduleEmail::with([ 'email.users', 'mode' ])->get()->map(function($value) { |
|
| 23 | 23 | $value->status_action_human = $value->status_action_human; |
| 24 | 24 | return $value; |
| 25 | 25 | }); |
@@ -50,17 +50,17 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function tableColumn() : JsonResponse |
| 52 | 52 | { |
| 53 | - $response = []; |
|
| 53 | + $response = [ ]; |
|
| 54 | 54 | |
| 55 | 55 | foreach (config('postman.ui.table') as $column => $size) { |
| 56 | - $response['columns'][] = [ |
|
| 56 | + $response[ 'columns' ][ ] = [ |
|
| 57 | 57 | 'prop' => $column, |
| 58 | 58 | 'size' => $size, |
| 59 | 59 | 'label' => trans("postman::dashboard.{$column}") |
| 60 | 60 | ]; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $response['button'] = [ |
|
| 63 | + $response[ 'button' ] = [ |
|
| 64 | 64 | 'edit' => trans('postman::dashboard.button.edit'), |
| 65 | 65 | 'remove' => trans('postman::dashboard.button.remove'), |
| 66 | 66 | ]; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | 'mode_id' => $request->mode, |
| 138 | 138 | 'status_action' => 0 |
| 139 | 139 | ]); |
| 140 | - return response()->json(['status' => true]); |
|
| 140 | + return response()->json([ 'status' => true ]); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | /** |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | $goalList->whereIn('user_id', $removal)->delete(); |
| 164 | 164 | |
| 165 | 165 | collect($request->users)->each(function($user_id) use($task, &$usersToEmail) { |
| 166 | - EmailUser::firstOrCreate(['email_id' => $task->email->id, 'user_id' => $user_id]); |
|
| 166 | + EmailUser::firstOrCreate([ 'email_id' => $task->email->id, 'user_id' => $user_id ]); |
|
| 167 | 167 | }); |
| 168 | - return response()->json(['status' => true]); |
|
| 168 | + return response()->json([ 'status' => true ]); |
|
| 169 | 169 | } |
| 170 | 170 | /** |
| 171 | 171 | * @param $id |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | use SoftDeletes; |
| 11 | 11 | |
| 12 | - protected $fillable = ['date' , 'email_id', 'mode_id', 'status_action']; |
|
| 12 | + protected $fillable = [ 'date', 'email_id', 'mode_id', 'status_action' ]; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * The attributes that should be cast to native types. |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function getStatusActionHumanAttribute($value) : string |
| 39 | 39 | { |
| 40 | - return trans("postman::dashboard.status_action." . $this->status_action); |
|
| 40 | + return trans("postman::dashboard.status_action.".$this->status_action); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function email() |
@@ -13,10 +13,10 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function postEmail(SheduleEmail $tasks) |
| 15 | 15 | { |
| 16 | - Mail::raw($tasks->email->text, function ($message) use ($tasks) { |
|
| 16 | + Mail::raw($tasks->email->text, function($message) use ($tasks) { |
|
| 17 | 17 | $message->subject($tasks->email->theme); |
| 18 | 18 | $message->from(config('mail.from.address')); |
| 19 | - $message->to($tasks->email->users->map(function($value){ return $value->email;})->toArray()); |
|
| 19 | + $message->to($tasks->email->users->map(function($value) { return $value->email; })->toArray()); |
|
| 20 | 20 | }); |
| 21 | 21 | |
| 22 | 22 | // if to reached the sender |
@@ -13,8 +13,8 @@ |
||
| 13 | 13 | { |
| 14 | 14 | public static function parse() : void |
| 15 | 15 | { |
| 16 | - SheduleEmail::whereRaw('CAST(date AS Datetime) <= ? AND status_action = ?', [Carbon::now(), 0])->get() |
|
| 17 | - ->each(function ($value) { |
|
| 16 | + SheduleEmail::whereRaw('CAST(date AS Datetime) <= ? AND status_action = ?', [ Carbon::now(), 0 ])->get() |
|
| 17 | + ->each(function($value) { |
|
| 18 | 18 | $value->mode->owner->postEmail($value); |
| 19 | 19 | }); |
| 20 | 20 | } |