@@ -2,11 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Illuminate\Console\Command; |
| 4 | 4 | use Illuminate\Foundation\Bus\DispatchesJobs; |
| 5 | -use JobApis\JobsToMail\Jobs\CollectJobsForUser; |
|
| 6 | 5 | use JobApis\JobsToMail\Jobs\SearchAndNotifyUser; |
| 7 | 6 | use JobApis\JobsToMail\Repositories\Contracts\SearchRepositoryInterface; |
| 8 | -use JobApis\JobsToMail\Repositories\SearchRepository; |
|
| 9 | -use JobApis\JobsToMail\Repositories\UserRepository; |
|
| 10 | 7 | |
| 11 | 8 | class EmailJobs extends Command |
| 12 | 9 | { |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | /** |
| 13 | 13 | * SearchRepository constructor. |
| 14 | 14 | * |
| 15 | - * @param Search $model |
|
| 16 | 15 | */ |
| 17 | 16 | public function __construct(Search $searches) |
| 18 | 17 | { |
@@ -27,10 +27,10 @@ |
||
| 27 | 27 | * |
| 28 | 28 | * @return Search |
| 29 | 29 | */ |
| 30 | - public function create($userId = null, $data = []) |
|
| 30 | + public function create($userId = null, $data = [ ]) |
|
| 31 | 31 | { |
| 32 | 32 | return $this->searches->create( |
| 33 | - array_merge(['user_id' => $userId], $data) |
|
| 33 | + array_merge([ 'user_id' => $userId ], $data) |
|
| 34 | 34 | ); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -use Illuminate\Support\Facades\Schema; |
|
| 4 | -use Illuminate\Database\Schema\Blueprint; |
|
| 5 | 3 | use Illuminate\Database\Migrations\Migration; |
| 4 | +use Illuminate\Database\Schema\Blueprint; |
|
| 5 | +use Illuminate\Support\Facades\Schema; |
|
| 6 | 6 | |
| 7 | 7 | class CreateTokensTable extends Migration |
| 8 | 8 | { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('searches', function (Blueprint $table) { |
|
| 16 | + Schema::create('searches', function(Blueprint $table) { |
|
| 17 | 17 | $table->uuid('id'); |
| 18 | 18 | $table->primary('id'); |
| 19 | 19 | $table->uuid('user_id')->unsigned(); |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * Create a new job instance. |
| 17 | 17 | */ |
| 18 | - public function __construct($data = []) |
|
| 18 | + public function __construct($data = [ ]) |
|
| 19 | 19 | { |
| 20 | 20 | $this->data = $data; |
| 21 | 21 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | parent::boot(); |
| 35 | 35 | |
| 36 | - static::creating(function ($model) { |
|
| 36 | + static::creating(function($model) { |
|
| 37 | 37 | $model->{$model->getKeyName()} = Uuid::uuid4(); |
| 38 | 38 | }); |
| 39 | 39 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function scopeActive($query) |
| 57 | 57 | { |
| 58 | - return $query->whereHas('user', function ($query) { |
|
| 58 | + return $query->whereHas('user', function($query) { |
|
| 59 | 59 | return $query->confirmed(); |
| 60 | 60 | }); |
| 61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function scopeWhereUserEmail($query, $email = null) |
| 69 | 69 | { |
| 70 | - return $query->whereHas('user', function ($query) use ($email) { |
|
| 70 | + return $query->whereHas('user', function($query) use ($email) { |
|
| 71 | 71 | return $query->where('email', $email); |
| 72 | 72 | }); |
| 73 | 73 | } |
@@ -4,11 +4,11 @@ |
||
| 4 | 4 | { |
| 5 | 5 | public function confirm($token = null); |
| 6 | 6 | |
| 7 | - public function create($data = []); |
|
| 7 | + public function create($data = [ ]); |
|
| 8 | 8 | |
| 9 | - public function firstOrCreate($data = []); |
|
| 9 | + public function firstOrCreate($data = [ ]); |
|
| 10 | 10 | |
| 11 | - public function getById($id = null, $options = []); |
|
| 11 | + public function getById($id = null, $options = [ ]); |
|
| 12 | 12 | |
| 13 | - public function update($id = null, $data = []); |
|
| 13 | + public function update($id = null, $data = [ ]); |
|
| 14 | 14 | } |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | interface SearchRepositoryInterface |
| 4 | 4 | { |
| 5 | - public function create($userId = null, $data = []); |
|
| 5 | + public function create($userId = null, $data = [ ]); |
|
| 6 | 6 | |
| 7 | 7 | public function getActive($userEmail = null); |
| 8 | 8 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $tokenObject = $this->getUnexpiredConfirmationToken($token); |
| 41 | 41 | if ($tokenObject) { |
| 42 | - if ($this->update($tokenObject->user_id, ['confirmed_at' => Carbon::now()])) { |
|
| 42 | + if ($this->update($tokenObject->user_id, [ 'confirmed_at' => Carbon::now() ])) { |
|
| 43 | 43 | return true; |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return \JobApis\JobsToMail\Models\User |
| 55 | 55 | */ |
| 56 | - public function create($data = []) |
|
| 56 | + public function create($data = [ ]) |
|
| 57 | 57 | { |
| 58 | 58 | $user = $this->users->create($data); |
| 59 | 59 | |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @return \JobApis\JobsToMail\Models\User |
| 71 | 71 | */ |
| 72 | - public function firstOrCreate($data = []) |
|
| 72 | + public function firstOrCreate($data = [ ]) |
|
| 73 | 73 | { |
| 74 | - if ($user = $this->users->where('email', $data['email'])->first()) { |
|
| 74 | + if ($user = $this->users->where('email', $data[ 'email' ])->first()) { |
|
| 75 | 75 | // Resend the user a confirmation token if they haven't confirmed |
| 76 | 76 | if (!$user->confirmed_at) { |
| 77 | 77 | $this->sendConfirmationToken($user); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @return \JobApis\JobsToMail\Models\User |
| 92 | 92 | */ |
| 93 | - public function getById($id = null, $options = []) |
|
| 93 | + public function getById($id = null, $options = [ ]) |
|
| 94 | 94 | { |
| 95 | 95 | return $this->users->where('id', $id)->first(); |
| 96 | 96 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @return boolean |
| 105 | 105 | */ |
| 106 | - public function update($id = null, $data = []) |
|
| 106 | + public function update($id = null, $data = [ ]) |
|
| 107 | 107 | { |
| 108 | 108 | return $this->users->where('id', $id)->update($data); |
| 109 | 109 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function via($notifiable) |
| 35 | 35 | { |
| 36 | - return ['mail']; |
|
| 36 | + return [ 'mail' ]; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | $url = config('app.url').'users/confirm/'.$this->token; |
| 48 | 48 | $message = new MailMessage; |
| 49 | - $message->viewData['user_id'] = $notifiable->id; |
|
| 49 | + $message->viewData[ 'user_id' ] = $notifiable->id; |
|
| 50 | 50 | return $message |
| 51 | 51 | ->subject('Confirm your email address to start receiving jobs') |
| 52 | 52 | ->greeting('Thank you for joining JobsToMail.com.') |