@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php namespace JobApis\JobsToMail\Jobs; |
| 2 | 2 | |
| 3 | 3 | use Illuminate\Bus\Queueable; |
| 4 | -use Illuminate\Queue\SerializesModels; |
|
| 5 | -use Illuminate\Queue\InteractsWithQueue; |
|
| 6 | 4 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 5 | +use Illuminate\Queue\InteractsWithQueue; |
|
| 6 | +use Illuminate\Queue\SerializesModels; |
|
| 7 | 7 | use Illuminate\Support\Facades\Log; |
| 8 | -use JobApis\Jobs\Client\JobsMulti; |
|
| 9 | 8 | use JobApis\JobsToMail\Models\User; |
| 10 | 9 | use JobApis\JobsToMail\Notifications\JobsCollected; |
| 10 | +use JobApis\Jobs\Client\JobsMulti; |
|
| 11 | 11 | |
| 12 | 12 | class CollectJobsForUser implements ShouldQueue |
| 13 | 13 | { |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | /** |
| 21 | 21 | * @var array Jobs collected from providers. |
| 22 | 22 | */ |
| 23 | - protected $jobs = []; |
|
| 23 | + protected $jobs = [ ]; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * @var Recruiter recruiter model |
@@ -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,14 +13,14 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('recruiters', function (Blueprint $table) { |
|
| 16 | + Schema::create('recruiters', function(Blueprint $table) { |
|
| 17 | 17 | $table->uuid('id')->primary(); |
| 18 | 18 | $table->string('name')->unique(); |
| 19 | 19 | $table->string('url')->nullable(); |
| 20 | 20 | $table->timestamps(); |
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | - Schema::table('searches', function (Blueprint $table) { |
|
| 23 | + Schema::table('searches', function(Blueprint $table) { |
|
| 24 | 24 | $table->boolean('no_recruiters')->default(false); |
| 25 | 25 | }); |
| 26 | 26 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function down() |
| 34 | 34 | { |
| 35 | - Schema::table('searches', function (Blueprint $table) { |
|
| 35 | + Schema::table('searches', function(Blueprint $table) { |
|
| 36 | 36 | $table->dropColumn('no_recruiters'); |
| 37 | 37 | }); |
| 38 | 38 | |
@@ -2,10 +2,9 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Faker\Factory as Faker; |
| 4 | 4 | use Illuminate\Database\Seeder; |
| 5 | -use JobApis\JobsToMail\Models\User; |
|
| 6 | -use JobApis\JobsToMail\Models\Recruiter; |
|
| 7 | 5 | use JobApis\JobsToMail\Models\Search; |
| 8 | 6 | use JobApis\JobsToMail\Models\Token; |
| 7 | +use JobApis\JobsToMail\Models\User; |
|
| 9 | 8 | |
| 10 | 9 | class TestingDatabaseSeeder extends Seeder |
| 11 | 10 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | parent::boot(); |
| 32 | 32 | |
| 33 | - static::creating(function ($model) { |
|
| 33 | + static::creating(function($model) { |
|
| 34 | 34 | $model->{$model->getKeyName()} = Uuid::uuid4(); |
| 35 | 35 | }); |
| 36 | 36 | } |
@@ -46,6 +46,6 @@ discard block |
||
| 46 | 46 | public function scopeWhereNameLike($query, $name = null) |
| 47 | 47 | { |
| 48 | 48 | $where = "to_tsvector('english', name) @@ plainto_tsquery('english', ?)"; |
| 49 | - return $query->whereRaw($where, [$name]); |
|
| 49 | + return $query->whereRaw($where, [ $name ]); |
|
| 50 | 50 | } |
| 51 | 51 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | { |
| 23 | 23 | // Make sure this search wants to filter recruiters |
| 24 | 24 | if ($search->no_recruiters === true) { |
| 25 | - return array_filter($jobs, function ($job) { |
|
| 25 | + return array_filter($jobs, function($job) { |
|
| 26 | 26 | // Make sure this job has a company |
| 27 | 27 | if (isset($job->company)) { |
| 28 | 28 | // Make sure this company is not a recruiter |
@@ -9,14 +9,14 @@ |
||
| 9 | 9 | * |
| 10 | 10 | * @return array |
| 11 | 11 | */ |
| 12 | - public function sort($jobs = [], $maxAge = 14, $maxJobs = 50) |
|
| 12 | + public function sort($jobs = [ ], $maxAge = 14, $maxJobs = 50) |
|
| 13 | 13 | { |
| 14 | 14 | // Sort by date |
| 15 | - usort($jobs, function ($item1, $item2) { |
|
| 15 | + usort($jobs, function($item1, $item2) { |
|
| 16 | 16 | return $item2->datePosted <=> $item1->datePosted; |
| 17 | 17 | }); |
| 18 | 18 | // Filter any older than max age |
| 19 | - $jobs = array_filter($jobs, function ($job) use ($maxAge) { |
|
| 19 | + $jobs = array_filter($jobs, function($job) use ($maxAge) { |
|
| 20 | 20 | return $job->datePosted > new \DateTime($maxAge.' days ago'); |
| 21 | 21 | }); |
| 22 | 22 | // Truncate to the max number of results |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | * |
| 13 | 13 | * @return array |
| 14 | 14 | */ |
| 15 | - public function getJobsFromCollections($collectionsArray = [], $max = 50) |
|
| 15 | + public function getJobsFromCollections($collectionsArray = [ ], $max = 50) |
|
| 16 | 16 | { |
| 17 | - $jobs = []; |
|
| 17 | + $jobs = [ ]; |
|
| 18 | 18 | array_walk_recursive( |
| 19 | 19 | $collectionsArray, |
| 20 | - function (Collection $collection) use (&$jobs, $max) { |
|
| 20 | + function(Collection $collection) use (&$jobs, $max) { |
|
| 21 | 21 | $this->logErrorsFromCollection($collection); |
| 22 | 22 | $jobListings = array_slice($collection->all(), 0, $max); |
| 23 | 23 | foreach ($jobListings as $jobListing) { |
| 24 | - $jobs[] = $jobListing; |
|
| 24 | + $jobs[ ] = $jobListing; |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | ); |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! empty($greeting)) { |
|
| 3 | +if (!empty($greeting)) { |
|
| 4 | 4 | echo $greeting, "\n\n"; |
| 5 | 5 | } else { |
| 6 | 6 | echo $level == 'error' ? 'Whoops!' : 'Hello!', "\n\n"; |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if (! empty($introLines)) { |
|
| 9 | +if (!empty($introLines)) { |
|
| 10 | 10 | echo implode("\n", $introLines), "\n\n"; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | if (isset($jobListings)) { |
| 14 | 14 | foreach ($jobListings as $listing) { |
| 15 | - echo $listing['title'].$listing['company'].$listing['location'].": ".$listing['link'], "\n"; |
|
| 16 | - if ($listing['date']) { |
|
| 17 | - echo "Posted on {$listing['date']}", "\n\n"; |
|
| 15 | + echo $listing[ 'title' ].$listing[ 'company' ].$listing[ 'location' ].": ".$listing[ 'link' ], "\n"; |
|
| 16 | + if ($listing[ 'date' ]) { |
|
| 17 | + echo "Posted on {$listing[ 'date' ]}", "\n\n"; |
|
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | echo "{$actionText}: {$actionUrl}", "\n\n"; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -if (! empty($outroLines)) { |
|
| 26 | +if (!empty($outroLines)) { |
|
| 27 | 27 | echo implode("\n", $outroLines), "\n\n"; |
| 28 | 28 | } |
| 29 | 29 | |