@@ -6,27 +6,27 @@ |
||
6 | 6 | use App\Models\Skill; |
7 | 7 | use App\Models\Lookup\SkillLevel; |
8 | 8 | |
9 | -$faker_fr = Faker\Factory::create('fr'); |
|
9 | +$faker_fr = Faker\Factory::create ('fr'); |
|
10 | 10 | |
11 | -$factory->define(Criteria::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
11 | +$factory->define (Criteria::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
12 | 12 | return [ |
13 | - 'criteria_type_id' => CriteriaType::inRandomOrder()->first()->id, |
|
13 | + 'criteria_type_id' => CriteriaType::inRandomOrder ()->first ()->id, |
|
14 | 14 | 'job_poster_id' => function () { |
15 | - return factory(JobPoster::class)->create()->id; |
|
15 | + return factory (JobPoster::class)->create ()->id; |
|
16 | 16 | }, |
17 | - 'skill_id' => Skill::inRandomOrder()->first()->id, |
|
18 | - 'skill_level_id' => SkillLevel::inRandomOrder()->first()->id, |
|
19 | - 'description:en' => $faker->paragraphs(2, true), |
|
20 | - 'description:fr' => $faker_fr->paragraphs(2, true), |
|
21 | - 'specificity:en' => $faker->sentence(), |
|
22 | - 'specificity:fr' => $faker_fr->sentence(), |
|
17 | + 'skill_id' => Skill::inRandomOrder ()->first ()->id, |
|
18 | + 'skill_level_id' => SkillLevel::inRandomOrder ()->first ()->id, |
|
19 | + 'description:en' => $faker->paragraphs (2, true), |
|
20 | + 'description:fr' => $faker_fr->paragraphs (2, true), |
|
21 | + 'specificity:en' => $faker->sentence (), |
|
22 | + 'specificity:fr' => $faker_fr->sentence (), |
|
23 | 23 | ]; |
24 | 24 | }); |
25 | 25 | |
26 | -$factory->state(Criteria::class, 'essential', [ |
|
27 | - 'criteria_type_id' => CriteriaType::where('name', 'essential')->first()->id |
|
26 | +$factory->state (Criteria::class, 'essential', [ |
|
27 | + 'criteria_type_id' => CriteriaType::where ('name', 'essential')->first ()->id |
|
28 | 28 | ]); |
29 | 29 | |
30 | -$factory->state(Criteria::class, 'asset', [ |
|
31 | - 'criteria_type_id' => CriteriaType::where('name', 'asset')->first()->id |
|
30 | +$factory->state (Criteria::class, 'asset', [ |
|
31 | + 'criteria_type_id' => CriteriaType::where ('name', 'asset')->first ()->id |
|
32 | 32 | ]); |
@@ -5,16 +5,16 @@ |
||
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 | - 'name' => $faker->word(), |
|
11 | - 'institution' => $faker->company(), |
|
12 | - 'course_status_id' => CourseStatus::inRandomOrder()->first()->id, |
|
13 | - 'start_date' => $faker->dateTimeBetween('-3 years', '-1 years'), |
|
14 | - 'end_date' => $faker->dateTimeBetween('-1 years', '-1 day'), |
|
10 | + 'name' => $faker->word (), |
|
11 | + 'institution' => $faker->company (), |
|
12 | + 'course_status_id' => CourseStatus::inRandomOrder ()->first ()->id, |
|
13 | + 'start_date' => $faker->dateTimeBetween ('-3 years', '-1 years'), |
|
14 | + 'end_date' => $faker->dateTimeBetween ('-1 years', '-1 day'), |
|
15 | 15 | 'courseable_id' => function () { |
16 | 16 | // Default factory item to belong to Applicant, not JobApplication |
17 | - return factory(Applicant::class)->create()->id; |
|
17 | + return factory (Applicant::class)->create ()->id; |
|
18 | 18 | }, |
19 | 19 | 'courseable_type' => 'applicant', |
20 | 20 | ]; |
@@ -5,16 +5,16 @@ |
||
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 | - 'name' => $faker->words(3, true), |
|
11 | - 'file_type_id' => FileType::inRandomOrder()->first()->id, |
|
12 | - 'url' => $faker->url(), |
|
13 | - 'description' => $faker->paragraph(), |
|
14 | - 'date_created' => $faker->dateTimeBetween('-3 years', '-1 years'), |
|
10 | + 'name' => $faker->words (3, true), |
|
11 | + 'file_type_id' => FileType::inRandomOrder ()->first ()->id, |
|
12 | + 'url' => $faker->url (), |
|
13 | + 'description' => $faker->paragraph (), |
|
14 | + 'date_created' => $faker->dateTimeBetween ('-3 years', '-1 years'), |
|
15 | 15 | 'work_sampleable_id' => function () { |
16 | 16 | // Factory items to belong to Applicant by default, not JobApplication |
17 | - return factory(Applicant::class)->create()->id; |
|
17 | + return factory (Applicant::class)->create ()->id; |
|
18 | 18 | }, |
19 | 19 | 'work_sampleable_type' => 'applicant', |
20 | 20 | ]; |
@@ -9,9 +9,9 @@ |
||
9 | 9 | * |
10 | 10 | * @return void |
11 | 11 | */ |
12 | - public function run() |
|
12 | + public function run () |
|
13 | 13 | { |
14 | - $this->call([ |
|
14 | + $this->call ([ |
|
15 | 15 | DevSeeder::class, |
16 | 16 | SkillClassificationSeeder::class |
17 | 17 | ]); |
@@ -53,107 +53,107 @@ |
||
53 | 53 | * |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function run() : void |
|
56 | + public function run () : void |
|
57 | 57 | { |
58 | - $adminUser = User::where('email', $this->adminEmail)->first(); |
|
58 | + $adminUser = User::where ('email', $this->adminEmail)->first (); |
|
59 | 59 | if ($adminUser === null) { |
60 | - $adminUser = factory(User::class)->state('admin')->create(['email' => $this->adminEmail]); |
|
60 | + $adminUser = factory (User::class)->state ('admin')->create (['email' => $this->adminEmail]); |
|
61 | 61 | } |
62 | 62 | |
63 | - $managerUser = User::where('email', $this->managerEmail)->first(); |
|
63 | + $managerUser = User::where ('email', $this->managerEmail)->first (); |
|
64 | 64 | // Create the test manager if it does not exist yet. |
65 | 65 | if ($managerUser === null) { |
66 | - $managerUser = factory(User::class)->state('upgradedManager')->create(['email' => $this->managerEmail]); |
|
67 | - $managerUser->manager()->save(factory(Manager::class)->create([ |
|
66 | + $managerUser = factory (User::class)->state ('upgradedManager')->create (['email' => $this->managerEmail]); |
|
67 | + $managerUser->manager ()->save (factory (Manager::class)->create ([ |
|
68 | 68 | 'user_id' => $managerUser->id |
69 | 69 | ])); |
70 | 70 | } |
71 | 71 | |
72 | - factory(JobPoster::class, 3)->state('published')->create([ |
|
72 | + factory (JobPoster::class, 3)->state ('published')->create ([ |
|
73 | 73 | 'manager_id' => $managerUser->manager->id |
74 | - ])->each(function ($job) : void { |
|
75 | - $job->job_applications()->saveMany(factory(JobApplication::class, 5))->create([ |
|
74 | + ])->each (function ($job) : void { |
|
75 | + $job->job_applications ()->saveMany (factory (JobApplication::class, 5))->create ([ |
|
76 | 76 | 'job_poster_id' => $job->id |
77 | 77 | ]); |
78 | 78 | // Then create one application with a priority user. |
79 | - $job->job_applications()->save(factory(JobApplication::class)->create([ |
|
79 | + $job->job_applications ()->save (factory (JobApplication::class)->create ([ |
|
80 | 80 | 'job_poster_id' => $job->id, |
81 | - 'applicant_id' => factory(Applicant::class)->create([ |
|
82 | - 'user_id' => factory(User::class)->state('priority')->create()->id |
|
81 | + 'applicant_id' => factory (Applicant::class)->create ([ |
|
82 | + 'user_id' => factory (User::class)->state ('priority')->create ()->id |
|
83 | 83 | ])->id |
84 | 84 | ])); |
85 | 85 | }); |
86 | - factory(JobPoster::class, 3)->state('closed')->create([ |
|
86 | + factory (JobPoster::class, 3)->state ('closed')->create ([ |
|
87 | 87 | 'manager_id' => $managerUser->manager->id |
88 | - ])->each(function ($job) : void { |
|
89 | - $job->job_applications()->saveMany(factory(JobApplication::class, 5))->create([ |
|
88 | + ])->each (function ($job) : void { |
|
89 | + $job->job_applications ()->saveMany (factory (JobApplication::class, 5))->create ([ |
|
90 | 90 | 'job_poster_id' => $job->id |
91 | 91 | ]); |
92 | 92 | // Then create one application with a priority user. |
93 | - $job->job_applications()->save(factory(JobApplication::class)->create([ |
|
93 | + $job->job_applications ()->save (factory (JobApplication::class)->create ([ |
|
94 | 94 | 'job_poster_id' => $job->id, |
95 | - 'applicant_id' => factory(Applicant::class)->create([ |
|
96 | - 'user_id' => factory(User::class)->state('priority')->create()->id |
|
95 | + 'applicant_id' => factory (Applicant::class)->create ([ |
|
96 | + 'user_id' => factory (User::class)->state ('priority')->create ()->id |
|
97 | 97 | ])->id |
98 | 98 | ])); |
99 | 99 | }); |
100 | - factory(JobPoster::class, 3)->state('draft')->create([ |
|
100 | + factory (JobPoster::class, 3)->state ('draft')->create ([ |
|
101 | 101 | 'manager_id' => $managerUser->manager->id |
102 | 102 | ]); |
103 | - factory(JobPoster::class, 3)->state('review_requested')->create([ |
|
103 | + factory (JobPoster::class, 3)->state ('review_requested')->create ([ |
|
104 | 104 | 'manager_id' => $managerUser->manager->id |
105 | 105 | ]); |
106 | 106 | |
107 | 107 | // Create a Job Poster with an Assessment Plan. |
108 | - $jobWithAssessment = factory(JobPoster::class)->state('draft')->create([ |
|
108 | + $jobWithAssessment = factory (JobPoster::class)->state ('draft')->create ([ |
|
109 | 109 | 'manager_id' => $managerUser->manager->id, |
110 | 110 | ]); |
111 | 111 | foreach ($jobWithAssessment->criteria as $criterion) { |
112 | 112 | // Create an assessment for each criterion. |
113 | - factory(Assessment::class)->state('withRatingGuide')->create([ |
|
113 | + factory (Assessment::class)->state ('withRatingGuide')->create ([ |
|
114 | 114 | 'criterion_id' => $criterion->id, |
115 | 115 | ]); |
116 | 116 | }; |
117 | 117 | |
118 | - $applicantUser = User::where('email', $this->applicantEmail)->first(); |
|
118 | + $applicantUser = User::where ('email', $this->applicantEmail)->first (); |
|
119 | 119 | if ($applicantUser === null) { |
120 | - $applicantUser = factory(User::class)->state('applicant')->create([ |
|
120 | + $applicantUser = factory (User::class)->state ('applicant')->create ([ |
|
121 | 121 | 'email' => $this->applicantEmail |
122 | 122 | ]); |
123 | - $applicantUser->applicant()->save(factory(Applicant::class)->create([ |
|
123 | + $applicantUser->applicant ()->save (factory (Applicant::class)->create ([ |
|
124 | 124 | 'user_id' => $applicantUser->id |
125 | 125 | ])); |
126 | 126 | } |
127 | 127 | |
128 | - $newApplicantUser = User::where('email', $this->newApplicantEmail)->first(); |
|
128 | + $newApplicantUser = User::where ('email', $this->newApplicantEmail)->first (); |
|
129 | 129 | if ($newApplicantUser === null) { |
130 | - $newApplicantUser = factory(User::class)->state('applicant')->create([ |
|
130 | + $newApplicantUser = factory (User::class)->state ('applicant')->create ([ |
|
131 | 131 | 'email' => $this->newApplicantEmail |
132 | 132 | ]); |
133 | - $newApplicantUser->applicant()->save(factory(Applicant::class)->create([ |
|
133 | + $newApplicantUser->applicant ()->save (factory (Applicant::class)->create ([ |
|
134 | 134 | 'user_id' => $newApplicantUser->id |
135 | 135 | ])); |
136 | 136 | } |
137 | 137 | |
138 | 138 | // Add to application profile. |
139 | - $applicantUser->applicant->references()->saveMany(factory(Reference::class, 3)->create([ |
|
139 | + $applicantUser->applicant->references ()->saveMany (factory (Reference::class, 3)->create ([ |
|
140 | 140 | 'referenceable_id' => $applicantUser->applicant->id |
141 | 141 | ])); |
142 | - $applicantUser->applicant->degrees()->saveMany(factory(Degree::class, 2)->create([ |
|
142 | + $applicantUser->applicant->degrees ()->saveMany (factory (Degree::class, 2)->create ([ |
|
143 | 143 | 'degreeable_id' => $applicantUser->applicant->id |
144 | 144 | ])); |
145 | - $applicantUser->applicant->courses()->saveMany(factory(Course::class, 3)->create([ |
|
145 | + $applicantUser->applicant->courses ()->saveMany (factory (Course::class, 3)->create ([ |
|
146 | 146 | 'courseable_id' => $applicantUser->applicant->id |
147 | 147 | ])); |
148 | - $applicantUser->applicant->work_experiences()->saveMany(factory(WorkExperience::class, 3)->create([ |
|
148 | + $applicantUser->applicant->work_experiences ()->saveMany (factory (WorkExperience::class, 3)->create ([ |
|
149 | 149 | 'experienceable_id' => $applicantUser->applicant->id |
150 | 150 | ])); |
151 | 151 | |
152 | 152 | // Create several applications for test user. |
153 | - $applicantUser->applicant->job_applications()->saveMany(factory(JobApplication::class, 3)->create([ |
|
153 | + $applicantUser->applicant->job_applications ()->saveMany (factory (JobApplication::class, 3)->create ([ |
|
154 | 154 | 'applicant_id' => $applicantUser->applicant->id, |
155 | 155 | ])); |
156 | - $applicantUser->applicant->job_applications()->saveMany(factory(JobApplication::class, 2)->state('draft')->create([ |
|
156 | + $applicantUser->applicant->job_applications ()->saveMany (factory (JobApplication::class, 2)->state ('draft')->create ([ |
|
157 | 157 | 'applicant_id' => $applicantUser->applicant->id, |
158 | 158 | ])); |
159 | 159 | } |
@@ -10,8 +10,8 @@ |
||
10 | 10 | * |
11 | 11 | * @return void |
12 | 12 | */ |
13 | - public function run() |
|
13 | + public function run () |
|
14 | 14 | { |
15 | - factory(JobPoster::class, 5)->create(); |
|
15 | + factory (JobPoster::class, 5)->create (); |
|
16 | 16 | } |
17 | 17 | } |
@@ -12,15 +12,15 @@ |
||
12 | 12 | * |
13 | 13 | * @return void |
14 | 14 | */ |
15 | - public function run() |
|
15 | + public function run () |
|
16 | 16 | { |
17 | - $skills = Skill::all(); |
|
17 | + $skills = Skill::all (); |
|
18 | 18 | |
19 | 19 | foreach ($skills as $skill) { |
20 | - $skill->classifications()->attach(Classification::inRandomOrder()->first()); |
|
21 | - $skill->is_culture_skill = (bool)random_int(0, 1); |
|
22 | - $skill->is_future_skill = (bool)random_int(0, 1); |
|
23 | - $skill->save(); |
|
20 | + $skill->classifications ()->attach (Classification::inRandomOrder ()->first ()); |
|
21 | + $skill->is_culture_skill = (bool) random_int (0, 1); |
|
22 | + $skill->is_future_skill = (bool) random_int (0, 1); |
|
23 | + $skill->save (); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | * |
13 | 13 | * @return void |
14 | 14 | */ |
15 | - public function run() |
|
15 | + public function run () |
|
16 | 16 | { |
17 | - factory(Manager::class, 10)->create(); |
|
18 | - factory(Applicant::class, 5)->create(); |
|
17 | + factory (Manager::class, 10)->create (); |
|
18 | + factory (Applicant::class, 5)->create (); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | } |