@@ -7,42 +7,42 @@ |
||
7 | 7 | use Illuminate\Support\Facades\Validator; |
8 | 8 | use Illuminate\Validation\Rule; |
9 | 9 | |
10 | -class JobApplicationAnswerValidator { |
|
10 | +class JobApplicationAnswerValidator{ |
|
11 | 11 | |
12 | 12 | protected $application; |
13 | 13 | protected $questionIds; |
14 | 14 | |
15 | - public function __construct(JobApplication $application) { |
|
15 | + public function __construct(JobApplication $application){ |
|
16 | 16 | $this->application = $application; |
17 | - $this->questionIds = $application->job_poster->job_poster_questions->pluck('id')->toArray(); |
|
17 | + $this->questionIds = $application->job_poster->job_poster_questions->pluck ('id')->toArray (); |
|
18 | 18 | } |
19 | 19 | |
20 | - public function rules() { |
|
20 | + public function rules(){ |
|
21 | 21 | $rules = [ |
22 | 22 | 'answer' => 'required|string', |
23 | 23 | 'job_poster_question_id' => [ |
24 | 24 | 'required', |
25 | - Rule::in($this->questionIds), |
|
25 | + Rule::in ($this->questionIds), |
|
26 | 26 | ], |
27 | 27 | 'job_application_id' => [ |
28 | 28 | 'required', |
29 | - Rule::in([$this->application->id]), |
|
29 | + Rule::in ([$this->application->id]), |
|
30 | 30 | ] |
31 | 31 | ]; |
32 | 32 | return $rules; |
33 | 33 | } |
34 | 34 | |
35 | - public function validator(JobApplicationAnswer $answer) { |
|
35 | + public function validator(JobApplicationAnswer $answer){ |
|
36 | 36 | |
37 | 37 | |
38 | - return Validator::make($answer->toArray(), $this->rules()); |
|
38 | + return Validator::make ($answer->toArray (), $this->rules ()); |
|
39 | 39 | } |
40 | 40 | |
41 | - public function validate(JobApplicationAnswer $answer) { |
|
42 | - return $this->validator($answer)->validate(); |
|
41 | + public function validate(JobApplicationAnswer $answer){ |
|
42 | + return $this->validator ($answer)->validate (); |
|
43 | 43 | } |
44 | 44 | |
45 | - public function isComplete(JobApplicationAnswer $answer) { |
|
46 | - return $this->validator($answer)->passes(); |
|
45 | + public function isComplete(JobApplicationAnswer $answer){ |
|
46 | + return $this->validator ($answer)->passes (); |
|
47 | 47 | } |
48 | 48 | } |
@@ -23,33 +23,33 @@ discard block |
||
23 | 23 | public function __construct(Applicant $applicant) |
24 | 24 | { |
25 | 25 | $this->applicant = $applicant; |
26 | - $this->skill_ids = Skill::all()->pluck('id'); |
|
27 | - $this->skill_status_ids = SkillStatus::all()->pluck('id'); |
|
28 | - $this->skill_level_ids = SkillLevel::all()->pluck('id'); |
|
26 | + $this->skill_ids = Skill::all ()->pluck ('id'); |
|
27 | + $this->skill_status_ids = SkillStatus::all ()->pluck ('id'); |
|
28 | + $this->skill_level_ids = SkillLevel::all ()->pluck ('id'); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
32 | - public function validator(SkillDeclaration $skillDeclaration) { |
|
33 | - $uniqueSkillRule = new UniqueApplicantSkillRule($this->applicant, $skillDeclaration->id); |
|
32 | + public function validator(SkillDeclaration $skillDeclaration){ |
|
33 | + $uniqueSkillRule = new UniqueApplicantSkillRule ($this->applicant, $skillDeclaration->id); |
|
34 | 34 | |
35 | 35 | //Validate basic data is filled in |
36 | - $validator = Validator::make($skillDeclaration->getAttributes(), [ |
|
36 | + $validator = Validator::make ($skillDeclaration->getAttributes (), [ |
|
37 | 37 | 'skill_id' => [ |
38 | 38 | 'required', |
39 | - Rule::in($this->skill_ids->toArray()), |
|
39 | + Rule::in ($this->skill_ids->toArray ()), |
|
40 | 40 | $uniqueSkillRule, |
41 | 41 | ], |
42 | 42 | 'applicant_id' => [ |
43 | 43 | 'required', |
44 | - Rule::in([$this->applicant->id]), |
|
44 | + Rule::in ([$this->applicant->id]), |
|
45 | 45 | ], |
46 | 46 | 'skill_status_id' => [ |
47 | 47 | 'required', |
48 | - Rule::in($this->skill_status_ids->toArray()), |
|
48 | + Rule::in ($this->skill_status_ids->toArray ()), |
|
49 | 49 | ], |
50 | 50 | 'skill_level_id' => [ |
51 | 51 | 'required', |
52 | - Rule::in($this->skill_level_ids->toArray()), |
|
52 | + Rule::in ($this->skill_level_ids->toArray ()), |
|
53 | 53 | ], |
54 | 54 | 'description' => 'required|string', |
55 | 55 | ]); |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | public function validate(SkillDeclaration $skillDeclaration) |
60 | 60 | { |
61 | - return $this->validator($skillDeclaration)->validate(); |
|
61 | + return $this->validator ($skillDeclaration)->validate (); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 |
@@ -31,13 +31,13 @@ |
||
31 | 31 | */ |
32 | 32 | public function passes($attribute, $value) |
33 | 33 | { |
34 | - return $value->contains(function ($object) { |
|
35 | - $object->getRelationValue($this->relationName)->is($this->relationValue); |
|
34 | + return $value->contains (function ($object){ |
|
35 | + $object->getRelationValue ($this->relationName)->is ($this->relationValue); |
|
36 | 36 | }); |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function message() |
40 | 40 | { |
41 | - return Lang::get('validation.contains_object_with_relation', ['relation' => $this->relationName]); |
|
41 | + return Lang::get ('validation.contains_object_with_relation', ['relation' => $this->relationName]); |
|
42 | 42 | } |
43 | 43 | } |
@@ -19,13 +19,13 @@ |
||
19 | 19 | * https://laraveldaily.com/how-to-create-custom-validation-rules-laravel/ |
20 | 20 | */ |
21 | 21 | |
22 | - public function passes($attribute, $value) { |
|
22 | + public function passes($attribute, $value){ |
|
23 | 23 | $passwordPattern = "~^.*(?=.{3,})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[.!@#$%^&*]).*$~"; |
24 | - return preg_match($passwordPattern, $value); |
|
24 | + return preg_match ($passwordPattern, $value); |
|
25 | 25 | } |
26 | 26 | |
27 | - public function message() { |
|
28 | - return Lang::get('validation.custom.password'); |
|
27 | + public function message(){ |
|
28 | + return Lang::get ('validation.custom.password'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | protected function array_any(array $array, callable $fn) |
28 | 28 | { |
29 | 29 | foreach ($array as $value) { |
30 | - if ($fn($value)) { |
|
30 | + if ($fn ($value)) { |
|
31 | 31 | return true; |
32 | 32 | } |
33 | 33 | } |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | // debugbar()->debug($value); |
47 | 47 | // debugbar()->debug($this->attributeName); |
48 | 48 | // debugbar()->debug($this->attributeValue); |
49 | - return $this->array_any($value, function ($object) { |
|
49 | + return $this->array_any ($value, function ($object){ |
|
50 | 50 | return $object[$this->attributeName] == $this->attributeValue; |
51 | 51 | }); |
52 | 52 | } |
53 | 53 | |
54 | 54 | public function message() |
55 | 55 | { |
56 | - return Lang::get('validation.contains_object_with_attribute', ['relation' => $this->attributeName, 'attributeValue' => $this->attributeValue]); |
|
56 | + return Lang::get ('validation.contains_object_with_attribute', ['relation' => $this->attributeName, 'attributeValue' => $this->attributeValue]); |
|
57 | 57 | } |
58 | 58 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | public function validate($request) |
10 | 10 | { |
11 | - abort(404, 'incomplete'); |
|
11 | + abort (404, 'incomplete'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | public function rules() |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | ]; |
22 | 22 | } |
23 | 23 | |
24 | - public function messages() { |
|
25 | - return Lang::get('validation.custom.password'); |
|
24 | + public function messages(){ |
|
25 | + return Lang::get ('validation.custom.password'); |
|
26 | 26 | } |
27 | 27 | } |
@@ -14,13 +14,13 @@ |
||
14 | 14 | */ |
15 | 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 | } |
@@ -6,31 +6,31 @@ |
||
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 | - 'name' => $faker->name(), |
|
12 | - 'email' => $faker->safeEmail(), |
|
13 | - 'description' => $faker->paragraphs(2, true), |
|
14 | - 'relationship_id' => Relationship::inRandomOrder()->first()->id, |
|
15 | - 'applicant_id' => function () { |
|
16 | - return factory(Applicant::class)->create()->id; |
|
11 | + 'name' => $faker->name (), |
|
12 | + 'email' => $faker->safeEmail (), |
|
13 | + 'description' => $faker->paragraphs (2, true), |
|
14 | + 'relationship_id' => Relationship::inRandomOrder ()->first ()->id, |
|
15 | + 'applicant_id' => function (){ |
|
16 | + return factory (Applicant::class)->create ()->id; |
|
17 | 17 | }, |
18 | 18 | ]; |
19 | 19 | }); |
20 | 20 | |
21 | -$factory->define(Project::class, function (Faker $faker) { |
|
21 | +$factory->define (Project::class, function (Faker $faker){ |
|
22 | 22 | return [ |
23 | - 'name' => $faker->sentence(), |
|
24 | - 'start_date' => $faker->dateTimeBetween('-3 years', '-1 years'), |
|
25 | - 'end_date' => $faker->dateTimeBetween('-1 years', '-1 day'), |
|
26 | - 'applicant_id' => function () { |
|
27 | - return factory(Applicant::class)->create()->id; |
|
23 | + 'name' => $faker->sentence (), |
|
24 | + 'start_date' => $faker->dateTimeBetween ('-3 years', '-1 years'), |
|
25 | + 'end_date' => $faker->dateTimeBetween ('-1 years', '-1 day'), |
|
26 | + 'applicant_id' => function (){ |
|
27 | + return factory (Applicant::class)->create ()->id; |
|
28 | 28 | }, |
29 | 29 | ]; |
30 | 30 | }); |
31 | 31 | |
32 | -$factory->afterCreating(Reference::class, function ($reference) : void { |
|
33 | - $reference->projects()->saveMany(factory(Project::class, 3)->make([ |
|
32 | +$factory->afterCreating (Reference::class, function ($reference) : void { |
|
33 | + $reference->projects ()->saveMany (factory (Project::class, 3)->make ([ |
|
34 | 34 | 'applicant_id' => $reference->applicant_id |
35 | 35 | ])); |
36 | 36 | }); |
@@ -5,12 +5,12 @@ |
||
5 | 5 | use App\Models\RatingGuideQuestion; |
6 | 6 | use App\Models\JobPoster; |
7 | 7 | |
8 | -$factory->define(RatingGuideQuestion::class, function (Faker\Generator $faker) { |
|
8 | +$factory->define (RatingGuideQuestion::class, function (Faker\Generator $faker){ |
|
9 | 9 | return [ |
10 | - 'job_poster_id' => function () { |
|
11 | - return factory(JobPoster::class)->create()->id; |
|
10 | + 'job_poster_id' => function (){ |
|
11 | + return factory (JobPoster::class)->create ()->id; |
|
12 | 12 | }, |
13 | - 'assessment_type_id' => AssessmentType::inRandomOrder()->first()->id, |
|
14 | - 'question' => $faker->sentence(), |
|
13 | + 'assessment_type_id' => AssessmentType::inRandomOrder ()->first ()->id, |
|
14 | + 'question' => $faker->sentence (), |
|
15 | 15 | ]; |
16 | 16 | }); |