@@ -2,8 +2,8 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Faker\Factory as Faker; |
| 4 | 4 | use Illuminate\Database\Seeder; |
| 5 | -use JobApis\JobsToMail\Models\User; |
|
| 6 | 5 | use JobApis\JobsToMail\Models\Token; |
| 6 | +use JobApis\JobsToMail\Models\User; |
|
| 7 | 7 | |
| 8 | 8 | class TestingDatabaseSeeder extends Seeder |
| 9 | 9 | { |
@@ -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 |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function via($notifiable) |
| 45 | 45 | { |
| 46 | - return ['mail', 'database']; |
|
| 46 | + return [ 'mail', 'database' ]; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | $message = new JobMailMessage(); |
| 73 | 73 | |
| 74 | 74 | // Add user and search ID to view data |
| 75 | - $message->viewData['user_id'] = $notifiable->id; |
|
| 76 | - $message->viewData['search_id'] = $this->search->id; |
|
| 75 | + $message->viewData[ 'user_id' ] = $notifiable->id; |
|
| 76 | + $message->viewData[ 'search_id' ] = $this->search->id; |
|
| 77 | 77 | |
| 78 | 78 | // Update the subject |
| 79 | 79 | $message->subject(count($this->jobs).' job listings found especially for you'); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | if ($notifiable->isPremium()) { |
| 94 | 94 | $message->action( |
| 95 | 95 | 'Download CSV', |
| 96 | - url('/collections/' . $this->id . '/download') |
|
| 96 | + url('/collections/'.$this->id.'/download') |
|
| 97 | 97 | ); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -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); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function boot() |
| 16 | 16 | { |
| 17 | 17 | // Only premium users can set this value to true |
| 18 | - Validator::extend('premium', function ($attribute, $value, $parameters, $validator) { |
|
| 18 | + Validator::extend('premium', function($attribute, $value, $parameters, $validator) { |
|
| 19 | 19 | if ($value == 1) { |
| 20 | 20 | return config('app.user_tiers.premium') === session()->get('user.tier'); |
| 21 | 21 | } |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | \JobApis\JobsToMail\Repositories\UserRepository::class |
| 42 | 42 | ); |
| 43 | 43 | // Job board API client |
| 44 | - $this->app->bind(JobsMulti::class, function () { |
|
| 44 | + $this->app->bind(JobsMulti::class, function() { |
|
| 45 | 45 | return new JobsMulti(config('jobboards')); |
| 46 | 46 | }); |
| 47 | 47 | // CSV Writer |
| 48 | - $this->app->bind('League\Csv\Writer', function ($app) { |
|
| 48 | + $this->app->bind('League\Csv\Writer', function($app) { |
|
| 49 | 49 | return Writer::createFromString(''); |
| 50 | 50 | }); |
| 51 | 51 | } |
@@ -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 | } |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | $notificationClass = \JobApis\JobsToMail\Models\CustomDatabaseNotification::class; |
| 9 | 9 | |
| 10 | -$factory->define($notificationClass, function (Faker\Generator $faker) { |
|
| 10 | +$factory->define($notificationClass, function(Faker\Generator $faker) { |
|
| 11 | 11 | return [ |
| 12 | 12 | 'id' => $faker->uuid(), |
| 13 | 13 | 'type' => 'JobApis\JobsToMail\Notifications\JobsCollected', |
| 14 | 14 | 'notifiable_id' => null, |
| 15 | 15 | 'notifiable_type' => 'user', |
| 16 | - 'data' => json_encode([]), |
|
| 16 | + 'data' => json_encode([ ]), |
|
| 17 | 17 | 'read_at' => null, |
| 18 | 18 | ]; |
| 19 | 19 | }); |