@@ -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 | } |
@@ -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 | } |
@@ -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 | }); |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Homepage |
4 | -Route::get('/', function () { |
|
4 | +Route::get('/', function() { |
|
5 | 5 | return view('users.index'); |
6 | 6 | }); |
7 | 7 | |
8 | 8 | // Terms page |
9 | -Route::get('/terms', function () { |
|
9 | +Route::get('/terms', function() { |
|
10 | 10 | return view('static.terms'); |
11 | 11 | }); |
12 | 12 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | // Current User Account page |
23 | 23 | Route::get('/searches', 'SearchesController@index')->middleware('auth'); |
24 | 24 | |
25 | -Route::group(['prefix' => 'auth'], function () { |
|
25 | +Route::group([ 'prefix' => 'auth' ], function() { |
|
26 | 26 | // Submit login form (part 1 of login) |
27 | 27 | Route::post('/login', 'AuthController@login'); |
28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | Route::get('/confirm/{token}', 'AuthController@confirm'); |
34 | 34 | }); |
35 | 35 | |
36 | -Route::group(['prefix' => 'users'], function () { |
|
36 | +Route::group([ 'prefix' => 'users' ], function() { |
|
37 | 37 | // Create new user |
38 | 38 | Route::post('/', 'UsersController@create'); |
39 | 39 | |
@@ -44,12 +44,12 @@ discard block |
||
44 | 44 | Route::get('/{userId}/searches', 'SearchesController@index'); |
45 | 45 | }); |
46 | 46 | |
47 | -Route::group(['prefix' => 'searches'], function () { |
|
47 | +Route::group([ 'prefix' => 'searches' ], function() { |
|
48 | 48 | // Unsubscribe by ID |
49 | 49 | Route::get('/{searchId}/unsubscribe', 'SearchesController@unsubscribe'); |
50 | 50 | }); |
51 | 51 | |
52 | -Route::group(['prefix' => 'collections'], function () { |
|
52 | +Route::group([ 'prefix' => 'collections' ], function() { |
|
53 | 53 | // Download jobs from a collection |
54 | 54 | Route::get('/{id}/download', 'CollectionsController@download'); |
55 | 55 | }); |