@@ -4,14 +4,14 @@ |
||
| 4 | 4 | use App\Models\Applicant; |
| 5 | 5 | use App\Models\WorkExperience; |
| 6 | 6 | |
| 7 | -$factory->define(WorkExperience::class, function (Faker $faker) { |
|
| 7 | +$factory->define(WorkExperience::class, function(Faker $faker){ |
|
| 8 | 8 | return [ |
| 9 | 9 | 'role' => $faker->word(), |
| 10 | 10 | 'company' => $faker->company(), |
| 11 | 11 | 'description' => $faker->paragraph(), |
| 12 | 12 | 'start_date' => $faker->dateTimeBetween('-3 years', '-1 years'), |
| 13 | 13 | 'end_date' => $faker->dateTimeBetween('-1 years', '-1 day'), |
| 14 | - 'experienceable_id' => function () { |
|
| 14 | + 'experienceable_id' => function(){ |
|
| 15 | 15 | // Factory items to belong to Applicant by default, not JobApplication |
| 16 | 16 | return factory(Applicant::class)->create()->id; |
| 17 | 17 | }, |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | $faker_fr = Faker\Factory::create('fr'); |
| 19 | 19 | |
| 20 | -$factory->define(JobPoster::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
| 20 | +$factory->define(JobPoster::class, function(Faker\Generator $faker) use ($faker_fr) { |
|
| 21 | 21 | $closeDate = $faker->dateTimeBetween('now', '1 months')->format('Y-m-d'); |
| 22 | 22 | $openDate = $faker->dateTimeBetween('-1 months', 'now')->format('Y-m-d'); |
| 23 | 23 | $startDate = $faker->dateTimeBetween('1 months', '2 months')->format('Y-m-d'); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | 'security_clearance_id' => SecurityClearance::inRandomOrder()->first()->id, |
| 61 | 61 | 'language_requirement_id' => LanguageRequirement::inRandomOrder()->first()->id, |
| 62 | 62 | 'remote_work_allowed' => $faker->boolean(50), |
| 63 | - 'manager_id' => function () { |
|
| 63 | + 'manager_id' => function(){ |
|
| 64 | 64 | return factory(Manager::class)->create()->id; |
| 65 | 65 | }, |
| 66 | 66 | 'team_size' => $faker->numberBetween(5, 30), |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ]; |
| 99 | 99 | }); |
| 100 | 100 | |
| 101 | -$factory->afterCreating(JobPoster::class, function ($jp) : void { |
|
| 101 | +$factory->afterCreating(JobPoster::class, function($jp) : void { |
|
| 102 | 102 | // Save at least one of each kind of criteria. |
| 103 | 103 | $jp->criteria()->save(factory(Criteria::class)->state('essential')->make([ |
| 104 | 104 | 'job_poster_id' => $jp->id |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $factory->state( |
| 122 | 122 | JobPoster::class, |
| 123 | 123 | 'byUpgradedManager', |
| 124 | - ['manager_id' => function () { |
|
| 124 | + ['manager_id' => function(){ |
|
| 125 | 125 | return factory(Manager::class)->state('upgraded')->create()->id; |
| 126 | 126 | }] |
| 127 | 127 | ); |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | $factory->state( |
| 130 | 130 | JobPoster::class, |
| 131 | 131 | 'published', |
| 132 | - function (Faker\Generator $faker) { |
|
| 132 | + function(Faker\Generator $faker){ |
|
| 133 | 133 | return [ |
| 134 | 134 | 'published' => true, |
| 135 | 135 | 'published_at' => $faker->dateTimeBetween('-1 months', '-3 weeks') |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $factory->state( |
| 141 | 141 | JobPoster::class, |
| 142 | 142 | 'closed', |
| 143 | - function (Faker\Generator $faker) { |
|
| 143 | + function(Faker\Generator $faker){ |
|
| 144 | 144 | return [ |
| 145 | 145 | 'published' => true, |
| 146 | 146 | 'published_at' => $faker->dateTimeBetween('-1 months', '-3 weeks'), |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $factory->state( |
| 153 | 153 | JobPoster::class, |
| 154 | 154 | 'draft', |
| 155 | - function (Faker\Generator $faker) { |
|
| 155 | + function(Faker\Generator $faker){ |
|
| 156 | 156 | return [ |
| 157 | 157 | 'published' => false, |
| 158 | 158 | 'open_date_time' => ptDayStartToUtcTime($faker->dateTimeBetween('5 days', '10 days')->format('Y-m-d')), |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $factory->state( |
| 167 | 167 | JobPoster::class, |
| 168 | 168 | 'review_requested', |
| 169 | - function (Faker\Generator $faker) { |
|
| 169 | + function(Faker\Generator $faker){ |
|
| 170 | 170 | return [ |
| 171 | 171 | 'published' => false, |
| 172 | 172 | 'open_date_time' => ptDayStartToUtcTime($faker->dateTimeBetween('5 days', '10 days')->format('Y-m-d')), |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | use App\Models\JobApplicationAnswer; |
| 11 | 11 | use App\Models\SkillDeclaration; |
| 12 | 12 | |
| 13 | -$factory->define(JobApplication::class, function (Faker\Generator $faker) { |
|
| 13 | +$factory->define(JobApplication::class, function(Faker\Generator $faker){ |
|
| 14 | 14 | return [ |
| 15 | - 'job_poster_id' => function () { |
|
| 15 | + 'job_poster_id' => function(){ |
|
| 16 | 16 | return factory(JobPoster::class)->states('published')->create()->id; |
| 17 | 17 | }, |
| 18 | 18 | 'language_requirement_confirmed' => true, |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | 'experience_saved' => true, |
| 24 | 24 | 'submission_signature' => $faker->name(), |
| 25 | 25 | 'submission_date' => $faker->dateTimeBetween('yesterday', 'tomorrow')->format('Y-m-d H:i:s'), |
| 26 | - 'applicant_id' => function () { |
|
| 26 | + 'applicant_id' => function(){ |
|
| 27 | 27 | return factory(Applicant::class)->create()->id; |
| 28 | 28 | } |
| 29 | 29 | ]; |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | 'submission_date' => null, |
| 36 | 36 | ]); |
| 37 | 37 | |
| 38 | -$factory->state(JobApplication::class, 'submitted', function (Faker\Generator $faker) { |
|
| 38 | +$factory->state(JobApplication::class, 'submitted', function(Faker\Generator $faker){ |
|
| 39 | 39 | return [ |
| 40 | 40 | 'application_status_id' => ApplicationStatus::where('name', 'submitted')->firstOrFail()->id, |
| 41 | 41 | 'submission_signature' => $faker->name(), |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | ]; |
| 45 | 45 | }); |
| 46 | 46 | |
| 47 | -$factory->afterCreating(JobApplication::class, function ($application) : void { |
|
| 47 | +$factory->afterCreating(JobApplication::class, function($application) : void { |
|
| 48 | 48 | foreach ($application->job_poster->job_poster_questions as $question) { |
| 49 | 49 | $answer = factory(JobApplicationAnswer::class)->create([ |
| 50 | 50 | 'job_poster_question_id' => $question->id, |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | use App\Models\Degree; |
| 6 | 6 | use App\Models\Lookup\DegreeType; |
| 7 | 7 | |
| 8 | -$factory->define(Degree::class, function (Faker $faker) { |
|
| 8 | +$factory->define(Degree::class, function(Faker $faker){ |
|
| 9 | 9 | return [ |
| 10 | 10 | 'degree_type_id' => DegreeType::inRandomOrder()->first()->id, |
| 11 | 11 | 'area_of_study' => $faker->word(), |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | 'thesis' => $faker->sentence(), |
| 14 | 14 | 'start_date' => $faker->dateTimeBetween('-3 years', '-1 years'), |
| 15 | 15 | 'end_date' => $faker->dateTimeBetween('-1 years', '-1 day'), |
| 16 | - 'degreeable_id' => function () { |
|
| 16 | + 'degreeable_id' => function(){ |
|
| 17 | 17 | // Default factory degrees to belong to Applicant, not JobApplication |
| 18 | 18 | return factory(Applicant::class)->create()->id; |
| 19 | 19 | }, |
@@ -5,14 +5,14 @@ |
||
| 5 | 5 | use App\Models\Course; |
| 6 | 6 | use App\Models\Lookup\CourseStatus; |
| 7 | 7 | |
| 8 | -$factory->define(Course::class, function (Faker $faker) { |
|
| 8 | +$factory->define(Course::class, function(Faker $faker){ |
|
| 9 | 9 | return [ |
| 10 | 10 | 'name' => $faker->word(), |
| 11 | 11 | 'institution' => $faker->company(), |
| 12 | 12 | 'course_status_id' => CourseStatus::inRandomOrder()->first()->id, |
| 13 | 13 | 'start_date' => $faker->dateTimeBetween('-3 years', '-1 years'), |
| 14 | 14 | 'end_date' => $faker->dateTimeBetween('-1 years', '-1 day'), |
| 15 | - 'courseable_id' => function () { |
|
| 15 | + 'courseable_id' => function(){ |
|
| 16 | 16 | // Default factory item to belong to Applicant, not JobApplication |
| 17 | 17 | return factory(Applicant::class)->create()->id; |
| 18 | 18 | }, |
@@ -6,12 +6,12 @@ |
||
| 6 | 6 | use App\Models\Lookup\SkillLevel; |
| 7 | 7 | use App\Models\Applicant; |
| 8 | 8 | |
| 9 | -$factory->define(SkillDeclaration::class, function (Faker\Generator $faker) { |
|
| 9 | +$factory->define(SkillDeclaration::class, function(Faker\Generator $faker){ |
|
| 10 | 10 | return [ |
| 11 | 11 | 'skill_id' => Skill::inRandomOrder()->first()->id, |
| 12 | 12 | 'skill_status_id' => SkillStatus::inRandomOrder()->first()->id, |
| 13 | 13 | 'skill_level_id' => SkillLevel::inRandomOrder()->first()->id, |
| 14 | - 'skillable_id' => function () { |
|
| 14 | + 'skillable_id' => function(){ |
|
| 15 | 15 | return factory(Applicant::class)->create()->id; |
| 16 | 16 | }, |
| 17 | 17 | 'skillable_type' => 'applicant', |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | use App\Models\Applicant; |
| 7 | 7 | use App\Models\Project; |
| 8 | 8 | |
| 9 | -$factory->define(Reference::class, function (Faker $faker) { |
|
| 9 | +$factory->define(Reference::class, function(Faker $faker){ |
|
| 10 | 10 | return [ |
| 11 | 11 | 'name' => $faker->name(), |
| 12 | 12 | 'email' => $faker->safeEmail(), |
| 13 | 13 | 'description' => $faker->paragraphs(2, true), |
| 14 | 14 | 'relationship_id' => Relationship::inRandomOrder()->first()->id, |
| 15 | - 'referenceable_id' => function () { |
|
| 15 | + 'referenceable_id' => function(){ |
|
| 16 | 16 | // Default factory references to belong to Applicant, not JobApplication. |
| 17 | 17 | return factory(Applicant::class)->create()->id; |
| 18 | 18 | }, |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | ]; |
| 21 | 21 | }); |
| 22 | 22 | |
| 23 | -$factory->define(Project::class, function (Faker $faker) { |
|
| 23 | +$factory->define(Project::class, function(Faker $faker){ |
|
| 24 | 24 | return [ |
| 25 | 25 | 'name' => $faker->sentence(), |
| 26 | 26 | 'start_date' => $faker->dateTimeBetween('-3 years', '-1 years'), |
| 27 | 27 | 'end_date' => $faker->dateTimeBetween('-1 years', '-1 day'), |
| 28 | - 'projectable_id' => function () { |
|
| 28 | + 'projectable_id' => function(){ |
|
| 29 | 29 | // Default factory references to belong to Applicant, not JobApplication. |
| 30 | 30 | return factory(Applicant::class)->create()->id; |
| 31 | 31 | }, |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | ]; |
| 34 | 34 | }); |
| 35 | 35 | |
| 36 | -$factory->afterCreating(Reference::class, function ($reference) : void { |
|
| 36 | +$factory->afterCreating(Reference::class, function($reference) : void { |
|
| 37 | 37 | $reference->projects()->saveMany(factory(Project::class, 3)->make([ |
| 38 | 38 | 'projectable_id' => $reference->referenceable_id, |
| 39 | 39 | 'projectable_type' => 'applicant' |
@@ -5,14 +5,14 @@ |
||
| 5 | 5 | use App\Models\Lookup\FileType; |
| 6 | 6 | use App\Models\WorkSample; |
| 7 | 7 | |
| 8 | -$factory->define(WorkSample::class, function (Faker $faker) { |
|
| 8 | +$factory->define(WorkSample::class, function(Faker $faker){ |
|
| 9 | 9 | return [ |
| 10 | 10 | 'name' => $faker->words(3, true), |
| 11 | 11 | 'file_type_id' => FileType::inRandomOrder()->first()->id, |
| 12 | 12 | 'url' => $faker->url(), |
| 13 | 13 | 'description' => $faker->paragraph(), |
| 14 | 14 | 'date_created' => $faker->dateTimeBetween('-3 years', '-1 years'), |
| 15 | - 'work_sampleable_id' => function () { |
|
| 15 | + 'work_sampleable_id' => function(){ |
|
| 16 | 16 | // Factory items to belong to Applicant by default, not JobApplication |
| 17 | 17 | return factory(Applicant::class)->create()->id; |
| 18 | 18 | }, |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | public function meetsEssentialCriteria(): bool |
| 261 | 261 | { |
| 262 | 262 | $essentialCriteria = $this->job_poster->criteria->filter( |
| 263 | - function ($value, $key) { |
|
| 263 | + function($value, $key){ |
|
| 264 | 264 | return $value->criteria_type->name == 'essential'; |
| 265 | 265 | } |
| 266 | 266 | ); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $this->courses()->saveMany($applicant->courses->map->replicate()); |
| 315 | 315 | $this->work_experiences()->saveMany($applicant->work_experiences->map->replicate()); |
| 316 | 316 | |
| 317 | - $copyWithHistory = function ($model) { |
|
| 317 | + $copyWithHistory = function($model){ |
|
| 318 | 318 | return [ |
| 319 | 319 | 'old' => $model, |
| 320 | 320 | 'new' => $model->replicate() |
@@ -333,19 +333,19 @@ discard block |
||
| 333 | 333 | $this->work_samples()->saveMany($workSampleMap->pluck('new')); |
| 334 | 334 | $this->skill_declarations()->saveMany($skillDeclarationMap->pluck('new')); |
| 335 | 335 | |
| 336 | - $findNewFromOld = function ($mapping, $old) { |
|
| 337 | - $matchingItem = $mapping->first(function ($value) use ($old) { |
|
| 336 | + $findNewFromOld = function($mapping, $old){ |
|
| 337 | + $matchingItem = $mapping->first(function($value) use ($old) { |
|
| 338 | 338 | return $value['old']->id === $old->id; |
| 339 | 339 | }); |
| 340 | 340 | return $matchingItem['new']; |
| 341 | 341 | }; |
| 342 | 342 | |
| 343 | 343 | // Replicate copies shallow attributes, but not relationships. We have to copy those ourselves. |
| 344 | - $findNewReferenceFromOld = function ($old) use ($findNewFromOld, $referenceMap) { |
|
| 344 | + $findNewReferenceFromOld = function($old) use ($findNewFromOld, $referenceMap) { |
|
| 345 | 345 | return $findNewFromOld($referenceMap, $old); |
| 346 | 346 | }; |
| 347 | 347 | |
| 348 | - $findNewSkillDeclarationFromOld = function ($old) use ($findNewFromOld, $skillDeclarationMap) { |
|
| 348 | + $findNewSkillDeclarationFromOld = function($old) use ($findNewFromOld, $skillDeclarationMap) { |
|
| 349 | 349 | return $findNewFromOld($skillDeclarationMap, $old); |
| 350 | 350 | }; |
| 351 | 351 | |