@@ -6,19 +6,19 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function confirm(User $user); |
| 8 | 8 | |
| 9 | - public function create($data = []); |
|
| 9 | + public function create($data = [ ]); |
|
| 10 | 10 | |
| 11 | 11 | public function delete($id = null); |
| 12 | 12 | |
| 13 | - public function firstOrCreate($data = []); |
|
| 13 | + public function firstOrCreate($data = [ ]); |
|
| 14 | 14 | |
| 15 | 15 | public function generateToken($user_id = null, $type = 'confirm'); |
| 16 | 16 | |
| 17 | - public function getById($id = null, $options = []); |
|
| 17 | + public function getById($id = null, $options = [ ]); |
|
| 18 | 18 | |
| 19 | 19 | public function getToken($token = null, $daysToExpire = 30); |
| 20 | 20 | |
| 21 | - public function getByEmail($email = null, $options = []); |
|
| 21 | + public function getByEmail($email = null, $options = [ ]); |
|
| 22 | 22 | |
| 23 | - public function update($id = null, $data = []); |
|
| 23 | + public function update($id = null, $data = [ ]); |
|
| 24 | 24 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function confirm(User $user) |
| 39 | 39 | { |
| 40 | 40 | if (!$user->confirmed_at) { |
| 41 | - if ($this->update($user->id, ['confirmed_at' => Carbon::now()])) { |
|
| 41 | + if ($this->update($user->id, [ 'confirmed_at' => Carbon::now() ])) { |
|
| 42 | 42 | return true; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return \JobApis\JobsToMail\Models\User |
| 54 | 54 | */ |
| 55 | - public function create($data = []) |
|
| 55 | + public function create($data = [ ]) |
|
| 56 | 56 | { |
| 57 | 57 | $user = $this->users->create($data); |
| 58 | 58 | |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return \JobApis\JobsToMail\Models\User |
| 82 | 82 | */ |
| 83 | - public function firstOrCreate($data = []) |
|
| 83 | + public function firstOrCreate($data = [ ]) |
|
| 84 | 84 | { |
| 85 | - if ($user = $this->users->where('email', $data['email'])->first()) { |
|
| 85 | + if ($user = $this->users->where('email', $data[ 'email' ])->first()) { |
|
| 86 | 86 | // Resend the user a confirmation token if they haven't confirmed |
| 87 | 87 | if (!$user->confirmed_at) { |
| 88 | 88 | $this->sendConfirmationToken($user); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @return \JobApis\JobsToMail\Models\User |
| 120 | 120 | */ |
| 121 | - public function getById($id = null, $options = []) |
|
| 121 | + public function getById($id = null, $options = [ ]) |
|
| 122 | 122 | { |
| 123 | 123 | return $this->users->where('id', $id)->first(); |
| 124 | 124 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return \JobApis\JobsToMail\Models\User |
| 133 | 133 | */ |
| 134 | - public function getByEmail($email = null, $options = []) |
|
| 134 | + public function getByEmail($email = null, $options = [ ]) |
|
| 135 | 135 | { |
| 136 | 136 | return $this->users->where('email', $email)->first(); |
| 137 | 137 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @return boolean |
| 161 | 161 | */ |
| 162 | - public function update($id = null, $data = []) |
|
| 162 | + public function update($id = null, $data = [ ]) |
|
| 163 | 163 | { |
| 164 | 164 | return $this->users->where('id', $id)->update($data); |
| 165 | 165 | } |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * Get the notification's delivery channels. |
| 30 | 30 | * |
| 31 | 31 | * @param mixed $notifiable |
| 32 | - * @return array |
|
| 32 | + * @return string[] |
|
| 33 | 33 | */ |
| 34 | 34 | public function via($notifiable) |
| 35 | 35 | { |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php namespace JobApis\JobsToMail\Notifications; |
| 2 | 2 | |
| 3 | 3 | use Illuminate\Bus\Queueable; |
| 4 | -use Illuminate\Notifications\Notification; |
|
| 5 | 4 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 6 | 5 | use Illuminate\Notifications\Messages\MailMessage; |
| 6 | +use Illuminate\Notifications\Notification; |
|
| 7 | 7 | use JobApis\JobsToMail\Models\Token; |
| 8 | 8 | |
| 9 | 9 | class TokenGenerated extends Notification implements ShouldQueue |
@@ -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.') |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::table('users', function (Blueprint $table) { |
|
| 16 | + Schema::table('users', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('tier')->default(config('app.user_tiers.free')); |
| 18 | 18 | $table->dropColumn('keyword'); |
| 19 | 19 | $table->dropColumn('location'); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function down() |
| 29 | 29 | { |
| 30 | - Schema::table('users', function (Blueprint $table) { |
|
| 30 | + Schema::table('users', function(Blueprint $table) { |
|
| 31 | 31 | $table->string('keyword')->nullable(); |
| 32 | 32 | $table->string('location')->nullable(); |
| 33 | 33 | $table->dropColumn('tier'); |
@@ -1,8 +1,8 @@ |
||
| 1 | 1 | <?php namespace JobApis\JobsToMail\Http\Controllers; |
| 2 | 2 | |
| 3 | +use Illuminate\Foundation\Validation\ValidatesRequests; |
|
| 3 | 4 | use Illuminate\Http\Request; |
| 4 | 5 | use Illuminate\Routing\Controller as BaseController; |
| 5 | -use Illuminate\Foundation\Validation\ValidatesRequests; |
|
| 6 | 6 | use JobApis\JobsToMail\Http\Requests\CreateUser; |
| 7 | 7 | use JobApis\JobsToMail\Repositories\Contracts\UserRepositoryInterface; |
| 8 | 8 | |
@@ -19,6 +19,6 @@ |
||
| 19 | 19 | |
| 20 | 20 | // sleep(2); |
| 21 | 21 | |
| 22 | - return response()->download($path, null, ['Content-Type: text/csv']); |
|
| 22 | + return response()->download($path, null, [ 'Content-Type: text/csv' ]); |
|
| 23 | 23 | } |
| 24 | 24 | } |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | * |
| 21 | 21 | * @param array $options |
| 22 | 22 | */ |
| 23 | - public function save(array $options = []) |
|
| 23 | + public function save(array $options = [ ]) |
|
| 24 | 24 | { |
| 25 | 25 | // Set the jobs and search id into their own fields |
| 26 | 26 | $data = $this->data; |
| 27 | - if (isset($data['search_id']) && isset($data['jobs'])) { |
|
| 28 | - $this->data = $data['jobs']; |
|
| 29 | - $this->search_id = $data['search_id']; |
|
| 27 | + if (isset($data[ 'search_id' ]) && isset($data[ 'jobs' ])) { |
|
| 28 | + $this->data = $data[ 'jobs' ]; |
|
| 29 | + $this->search_id = $data[ 'search_id' ]; |
|
| 30 | 30 | } |
| 31 | 31 | parent::save(); |
| 32 | 32 | } |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | * |
| 11 | 11 | * @return array |
| 12 | 12 | */ |
| 13 | - public function filterFields($jobs = [], $fields = []) |
|
| 13 | + public function filterFields($jobs = [ ], $fields = [ ]) |
|
| 14 | 14 | { |
| 15 | 15 | foreach ($jobs as &$job) { |
| 16 | - $job = array_filter($job, function ($key) use ($fields) { |
|
| 16 | + $job = array_filter($job, function($key) use ($fields) { |
|
| 17 | 17 | return in_array($key, $fields); |
| 18 | 18 | }, ARRAY_FILTER_USE_KEY); |
| 19 | 19 | } |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return array |
| 29 | 29 | */ |
| 30 | - public function sort($jobs = [], $maxAge = 14, $maxJobs = 50) |
|
| 30 | + public function sort($jobs = [ ], $maxAge = 14, $maxJobs = 50) |
|
| 31 | 31 | { |
| 32 | 32 | // Sort by date |
| 33 | - usort($jobs, function ($item1, $item2) { |
|
| 33 | + usort($jobs, function($item1, $item2) { |
|
| 34 | 34 | return $item2->datePosted <=> $item1->datePosted; |
| 35 | 35 | }); |
| 36 | 36 | // Filter any older than max age |
| 37 | - $jobs = array_filter($jobs, function ($job) use ($maxAge) { |
|
| 37 | + $jobs = array_filter($jobs, function($job) use ($maxAge) { |
|
| 38 | 38 | return $job->datePosted > new \DateTime($maxAge.' days ago'); |
| 39 | 39 | }); |
| 40 | 40 | // Truncate to the max number of results |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | return $this->createCsv($csv, $jobs, $this->id.'.csv'); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - private function createCsv(Writer $csv, array $items = [], $filename = null) |
|
| 56 | + private function createCsv(Writer $csv, array $items = [ ], $filename = null) |
|
| 57 | 57 | { |
| 58 | 58 | // Make sure line endings are detected. |
| 59 | 59 | if (!ini_get("auto_detect_line_endings")) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $csv = $csv->createFromPath($path, 'x+'); |
| 68 | 68 | |
| 69 | 69 | // Add header rows |
| 70 | - $csv->insertOne(array_keys($items[0])); |
|
| 70 | + $csv->insertOne(array_keys($items[ 0 ])); |
|
| 71 | 71 | |
| 72 | 72 | // Add each item as a new line to the CSV |
| 73 | 73 | $csv->insertAll($items); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::table('notifications', function (Blueprint $table) { |
|
| 16 | + Schema::table('notifications', function(Blueprint $table) { |
|
| 17 | 17 | $table->uuid('search_id')->nullable()->unsigned(); |
| 18 | 18 | $table->foreign('search_id')->references('id')->on('searches'); |
| 19 | 19 | }); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function down() |
| 28 | 28 | { |
| 29 | - Schema::table('notifications', function (Blueprint $table) { |
|
| 29 | + Schema::table('notifications', function(Blueprint $table) { |
|
| 30 | 30 | $table->dropColumn('search_id'); |
| 31 | 31 | }); |
| 32 | 32 | } |