@@ -56,6 +56,6 @@ |
||
56 | 56 | */ |
57 | 57 | public function build() |
58 | 58 | { |
59 | - return $this->text('emails.job_posters.review_requested_plain'); |
|
59 | + return $this->text ('emails.job_posters.review_requested_plain'); |
|
60 | 60 | } |
61 | 61 | } |
@@ -12,6 +12,6 @@ |
||
12 | 12 | */ |
13 | 13 | public function run() |
14 | 14 | { |
15 | - factory(JobPoster::class, 5)->create(); |
|
15 | + factory (JobPoster::class, 5)->create (); |
|
16 | 16 | } |
17 | 17 | } |
@@ -14,8 +14,8 @@ |
||
14 | 14 | */ |
15 | 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 | } |
@@ -44,86 +44,86 @@ |
||
44 | 44 | */ |
45 | 45 | public function run() : void |
46 | 46 | { |
47 | - $adminUser = User::where('email', $this->adminEmail)->first(); |
|
47 | + $adminUser = User::where ('email', $this->adminEmail)->first (); |
|
48 | 48 | if ($adminUser === null) { |
49 | - $adminUser = factory(User::class)->state('admin')->create(['email' => $this->adminEmail]); |
|
49 | + $adminUser = factory (User::class)->state ('admin')->create (['email' => $this->adminEmail]); |
|
50 | 50 | } |
51 | 51 | |
52 | - $managerUser = User::where('email', $this->managerEmail)->first(); |
|
52 | + $managerUser = User::where ('email', $this->managerEmail)->first (); |
|
53 | 53 | // Create the test manager if it does not exist yet. |
54 | 54 | if ($managerUser === null) { |
55 | - $managerUser = factory(User::class)->state('upgradedManager')->create(['email' => $this->managerEmail]); |
|
56 | - $managerUser->manager()->save(factory(Manager::class)->create([ |
|
55 | + $managerUser = factory (User::class)->state ('upgradedManager')->create (['email' => $this->managerEmail]); |
|
56 | + $managerUser->manager ()->save (factory (Manager::class)->create ([ |
|
57 | 57 | 'user_id' => $managerUser->id |
58 | 58 | ])); |
59 | 59 | } |
60 | 60 | |
61 | - factory(JobPoster::class, 3)->state('published')->create([ |
|
61 | + factory (JobPoster::class, 3)->state ('published')->create ([ |
|
62 | 62 | 'manager_id' => $managerUser->manager->id |
63 | - ])->each(function ($job) : void { |
|
64 | - $job->job_applications()->saveMany(factory(JobApplication::class, 5))->create([ |
|
63 | + ])->each (function ($job) : void { |
|
64 | + $job->job_applications ()->saveMany (factory (JobApplication::class, 5))->create ([ |
|
65 | 65 | 'job_poster_id' => $job->id |
66 | 66 | ]); |
67 | 67 | // Then create one application with a priority user. |
68 | - $job->job_applications()->save(factory(JobApplication::class)->create([ |
|
68 | + $job->job_applications ()->save (factory (JobApplication::class)->create ([ |
|
69 | 69 | 'job_poster_id' => $job->id, |
70 | - 'applicant_id' => factory(Applicant::class)->create([ |
|
71 | - 'user_id' => factory(User::class)->state('priority')->create()->id |
|
70 | + 'applicant_id' => factory (Applicant::class)->create ([ |
|
71 | + 'user_id' => factory (User::class)->state ('priority')->create ()->id |
|
72 | 72 | ])->id |
73 | 73 | ])); |
74 | 74 | }); |
75 | - factory(JobPoster::class, 3)->state('closed')->create([ |
|
75 | + factory (JobPoster::class, 3)->state ('closed')->create ([ |
|
76 | 76 | 'manager_id' => $managerUser->manager->id |
77 | - ])->each(function ($job) : void { |
|
78 | - $job->job_applications()->saveMany(factory(JobApplication::class, 5))->create([ |
|
77 | + ])->each (function ($job) : void { |
|
78 | + $job->job_applications ()->saveMany (factory (JobApplication::class, 5))->create ([ |
|
79 | 79 | 'job_poster_id' => $job->id |
80 | 80 | ]); |
81 | 81 | // Then create one application with a priority user. |
82 | - $job->job_applications()->save(factory(JobApplication::class)->create([ |
|
82 | + $job->job_applications ()->save (factory (JobApplication::class)->create ([ |
|
83 | 83 | 'job_poster_id' => $job->id, |
84 | - 'applicant_id' => factory(Applicant::class)->create([ |
|
85 | - 'user_id' => factory(User::class)->state('priority')->create()->id |
|
84 | + 'applicant_id' => factory (Applicant::class)->create ([ |
|
85 | + 'user_id' => factory (User::class)->state ('priority')->create ()->id |
|
86 | 86 | ])->id |
87 | 87 | ])); |
88 | 88 | }); |
89 | - factory(JobPoster::class, 3)->state('draft')->create([ |
|
89 | + factory (JobPoster::class, 3)->state ('draft')->create ([ |
|
90 | 90 | 'manager_id' => $managerUser->manager->id |
91 | 91 | ]); |
92 | - factory(JobPoster::class, 3)->state('review_requested')->create([ |
|
92 | + factory (JobPoster::class, 3)->state ('review_requested')->create ([ |
|
93 | 93 | 'manager_id' => $managerUser->manager->id |
94 | 94 | ]); |
95 | 95 | |
96 | 96 | // Create a Job Poster with an Assessment Plan. |
97 | - $jobWithAssessment = factory(JobPoster::class)->state('draft')->create([ |
|
97 | + $jobWithAssessment = factory (JobPoster::class)->state ('draft')->create ([ |
|
98 | 98 | 'manager_id' => $managerUser->manager->id, |
99 | 99 | ]); |
100 | 100 | foreach ($jobWithAssessment->criteria as $criterion) { |
101 | 101 | // Create an assessment for each criterion. |
102 | - factory(Assessment::class)->state('withRatingGuide')->create([ |
|
102 | + factory (Assessment::class)->state ('withRatingGuide')->create ([ |
|
103 | 103 | 'criterion_id' => $criterion->id, |
104 | 104 | ]); |
105 | 105 | }; |
106 | 106 | |
107 | - $applicantUser = User::where('email', $this->applicantEmail)->first(); |
|
107 | + $applicantUser = User::where ('email', $this->applicantEmail)->first (); |
|
108 | 108 | if ($applicantUser === null) { |
109 | - $applicantUser = factory(User::class)->state('applicant')->create([ |
|
109 | + $applicantUser = factory (User::class)->state ('applicant')->create ([ |
|
110 | 110 | 'email' => $this->applicantEmail |
111 | 111 | ]); |
112 | - $applicantUser->applicant()->save(factory(Applicant::class)->create([ |
|
112 | + $applicantUser->applicant ()->save (factory (Applicant::class)->create ([ |
|
113 | 113 | 'user_id' => $applicantUser->id |
114 | 114 | ])); |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Add to application profile. |
118 | - $applicantUser->applicant->references()->saveMany(factory(Reference::class, 3)->create([ |
|
118 | + $applicantUser->applicant->references ()->saveMany (factory (Reference::class, 3)->create ([ |
|
119 | 119 | 'applicant_id' => $applicantUser->applicant->id |
120 | 120 | ])); |
121 | 121 | |
122 | 122 | // Create several applications for test user. |
123 | - $applicantUser->applicant->job_applications()->saveMany(factory(JobApplication::class, 3)->create([ |
|
123 | + $applicantUser->applicant->job_applications ()->saveMany (factory (JobApplication::class, 3)->create ([ |
|
124 | 124 | 'applicant_id' => $applicantUser->applicant->id, |
125 | 125 | ])); |
126 | - $applicantUser->applicant->job_applications()->saveMany(factory(JobApplication::class, 2)->state('draft')->create([ |
|
126 | + $applicantUser->applicant->job_applications ()->saveMany (factory (JobApplication::class, 2)->state ('draft')->create ([ |
|
127 | 127 | 'applicant_id' => $applicantUser->applicant->id, |
128 | 128 | ])); |
129 | 129 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | public function authorize() : bool |
15 | 15 | { |
16 | 16 | // Only allow updates if the user is a logged in Admin. |
17 | - return backpack_auth()->check(); |
|
17 | + return backpack_auth ()->check (); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | /** |
@@ -18,33 +18,33 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function store(Request $request) |
20 | 20 | { |
21 | - $this->authorize('create', Assessment::class); |
|
21 | + $this->authorize ('create', Assessment::class); |
|
22 | 22 | |
23 | 23 | try { |
24 | - $criterion_id = (int)$request->json('criterion_id'); |
|
25 | - $assessment_type_id = (int)$request->json('assessment_type_id'); |
|
26 | - $criteria = Criteria::findOrFail($criterion_id); |
|
27 | - AssessmentType::findOrFail($assessment_type_id); |
|
24 | + $criterion_id = (int)$request->json ('criterion_id'); |
|
25 | + $assessment_type_id = (int)$request->json ('assessment_type_id'); |
|
26 | + $criteria = Criteria::findOrFail ($criterion_id); |
|
27 | + AssessmentType::findOrFail ($assessment_type_id); |
|
28 | 28 | |
29 | - $assessment = new Assessment([ |
|
29 | + $assessment = new Assessment ([ |
|
30 | 30 | 'criterion_id' => $criterion_id, |
31 | 31 | 'assessment_type_id' => $assessment_type_id |
32 | 32 | ]); |
33 | 33 | // Check that this user is allowed to create an Assessment for this criterion. |
34 | - $this->authorize('update', $assessment); |
|
34 | + $this->authorize ('update', $assessment); |
|
35 | 35 | |
36 | - $assessment->save(); |
|
37 | - $assessment->refresh(); |
|
38 | - $assessment['criteria'] = $criteria->toArray(); |
|
36 | + $assessment->save (); |
|
37 | + $assessment->refresh (); |
|
38 | + $assessment['criteria'] = $criteria->toArray (); |
|
39 | 39 | } catch (\Exception $e) { |
40 | - return response()->json([ |
|
41 | - 'error' => $e->getMessage() |
|
40 | + return response ()->json ([ |
|
41 | + 'error' => $e->getMessage () |
|
42 | 42 | ], 400); |
43 | 43 | } |
44 | 44 | |
45 | 45 | return [ |
46 | 46 | 'success' => "Successfully created assessment $assessment->id", |
47 | - 'assessment' => $assessment->toArray() |
|
47 | + 'assessment' => $assessment->toArray () |
|
48 | 48 | ]; |
49 | 49 | } |
50 | 50 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function show(Assessment $assessment) |
58 | 58 | { |
59 | - $this->authorize('view', $assessment); |
|
60 | - $criteria = Criteria::find($assessment->id); |
|
61 | - $assessment['criteria'] = $criteria->toArray(); |
|
62 | - return $assessment->toArray(); |
|
59 | + $this->authorize ('view', $assessment); |
|
60 | + $criteria = Criteria::find ($assessment->id); |
|
61 | + $assessment['criteria'] = $criteria->toArray (); |
|
62 | + return $assessment->toArray (); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -71,26 +71,26 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function update(Request $request, Assessment $assessment) |
73 | 73 | { |
74 | - $this->authorize('update', $assessment); |
|
74 | + $this->authorize ('update', $assessment); |
|
75 | 75 | try { |
76 | - $criterion_id = (int)$request->json('criterion_id'); |
|
77 | - $assessment_type_id = (int)$request->json('assessment_type_id'); |
|
78 | - $criteria = Criteria::findOrFail($criterion_id); |
|
79 | - AssessmentType::findOrFail($assessment_type_id); |
|
76 | + $criterion_id = (int)$request->json ('criterion_id'); |
|
77 | + $assessment_type_id = (int)$request->json ('assessment_type_id'); |
|
78 | + $criteria = Criteria::findOrFail ($criterion_id); |
|
79 | + AssessmentType::findOrFail ($assessment_type_id); |
|
80 | 80 | |
81 | 81 | $assessment->criterion_id = $criterion_id; |
82 | 82 | $assessment->assessment_type_id = $assessment_type_id; |
83 | - $assessment->save(); |
|
84 | - $assessment['criteria'] = $criteria->toArray(); |
|
83 | + $assessment->save (); |
|
84 | + $assessment['criteria'] = $criteria->toArray (); |
|
85 | 85 | } catch (\Exception $e) { |
86 | - return response()->json([ |
|
87 | - 'error' => $e->getMessage() |
|
86 | + return response ()->json ([ |
|
87 | + 'error' => $e->getMessage () |
|
88 | 88 | ], 400); |
89 | 89 | } |
90 | 90 | |
91 | 91 | return [ |
92 | 92 | 'success' => "Successfully updated assessment $assessment->id", |
93 | - 'assessment' => $assessment->toArray(), |
|
93 | + 'assessment' => $assessment->toArray (), |
|
94 | 94 | ]; |
95 | 95 | } |
96 | 96 | |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function destroy(Assessment $assessment) |
104 | 104 | { |
105 | - $this->authorize('delete', $assessment); |
|
106 | - $assessment->delete(); |
|
105 | + $this->authorize ('delete', $assessment); |
|
106 | + $assessment->delete (); |
|
107 | 107 | |
108 | 108 | return [ |
109 | 109 | 'success' => "Successfully deleted assessment $assessment->id" |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function index() |
21 | 21 | { |
22 | - $applications = Auth::user()->applicant->job_applications; |
|
23 | - return view( |
|
22 | + $applications = Auth::user ()->applicant->job_applications; |
|
23 | + return view ( |
|
24 | 24 | 'applicant/application_index', |
25 | 25 | [ |
26 | - 'application_index' => Lang::get('applicant/application_index'), |
|
26 | + 'application_index' => Lang::get ('applicant/application_index'), |
|
27 | 27 | 'applications' => $applications, |
28 | - 'departments_template' => Lang::get('common/lookup/departments'), |
|
28 | + 'departments_template' => Lang::get ('common/lookup/departments'), |
|
29 | 29 | 'manager_profile_photo' => '/images/user.png', // TODO: get real photo. |
30 | 30 | ] |
31 | 31 | ); |
@@ -40,48 +40,47 @@ discard block |
||
40 | 40 | public function show(JobApplication $application) |
41 | 41 | { |
42 | 42 | $criteria = [ |
43 | - 'essential' => $application->job_poster->criteria->filter(function ($value, $key) { |
|
43 | + 'essential' => $application->job_poster->criteria->filter (function ($value, $key){ |
|
44 | 44 | return $value->criteria_type->name == 'essential'; |
45 | 45 | }), |
46 | - 'asset' => $application->job_poster->criteria->filter(function ($value, $key) { |
|
46 | + 'asset' => $application->job_poster->criteria->filter (function ($value, $key){ |
|
47 | 47 | return $value->criteria_type->name == 'asset'; |
48 | 48 | }), |
49 | 49 | ]; |
50 | 50 | |
51 | 51 | // Display slightly different views on different portals. |
52 | - $view = WhichPortal::isManagerPortal() ? |
|
53 | - 'manager/application_post' : |
|
54 | - 'applicant/application_preview'; |
|
52 | + $view = WhichPortal::isManagerPortal () ? |
|
53 | + 'manager/application_post' : 'applicant/application_preview'; |
|
55 | 54 | |
56 | - if (WhichPortal::isManagerPortal()) { |
|
55 | + if (WhichPortal::isManagerPortal ()) { |
|
57 | 56 | // Load things required for review component. |
58 | - $application->load(['veteran_status', 'citizenship_declaration', 'application_review', 'applicant.user']); |
|
57 | + $application->load (['veteran_status', 'citizenship_declaration', 'application_review', 'applicant.user']); |
|
59 | 58 | } |
60 | 59 | |
61 | - return view( |
|
60 | + return view ( |
|
62 | 61 | $view, |
63 | 62 | [ |
64 | 63 | // Localized strings. |
65 | - 'post' => Lang::get('manager/application_post'), // Change text |
|
66 | - 'is_manager_view' => WhichPortal::isManagerPortal(), |
|
64 | + 'post' => Lang::get ('manager/application_post'), // Change text |
|
65 | + 'is_manager_view' => WhichPortal::isManagerPortal (), |
|
67 | 66 | // Application Template Data. |
68 | - 'application_template' => Lang::get('applicant/application_template'), |
|
67 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
69 | 68 | 'application_preview' => true, |
70 | - 'preferred_language_template' => Lang::get('common/preferred_language'), |
|
71 | - 'citizenship_declaration_template' => Lang::get('common/citizenship_declaration'), |
|
72 | - 'veteran_status_template' => Lang::get('common/veteran_status'), |
|
69 | + 'preferred_language_template' => Lang::get ('common/preferred_language'), |
|
70 | + 'citizenship_declaration_template' => Lang::get ('common/citizenship_declaration'), |
|
71 | + 'veteran_status_template' => Lang::get ('common/veteran_status'), |
|
73 | 72 | // Job Data. |
74 | 73 | 'job' => $application->job_poster, |
75 | 74 | // Skills Data. |
76 | - 'skills' => Skill::all(), |
|
77 | - 'skill_template' => Lang::get('common/skills'), |
|
78 | - 'reference_template' => Lang::get('common/references'), |
|
79 | - 'sample_template' => Lang::get('common/work_samples'), |
|
75 | + 'skills' => Skill::all (), |
|
76 | + 'skill_template' => Lang::get ('common/skills'), |
|
77 | + 'reference_template' => Lang::get ('common/references'), |
|
78 | + 'sample_template' => Lang::get ('common/work_samples'), |
|
80 | 79 | 'criteria' => $criteria, |
81 | 80 | // Applicant Data. |
82 | 81 | 'applicant' => $application->applicant, |
83 | 82 | 'job_application' => $application, |
84 | - 'review_statuses' => ReviewStatus::all(), |
|
83 | + 'review_statuses' => ReviewStatus::all (), |
|
85 | 84 | ] |
86 | 85 | ); |
87 | 86 | } |
@@ -95,16 +94,16 @@ discard block |
||
95 | 94 | */ |
96 | 95 | public function destroy(Request $request, JobApplication $application) |
97 | 96 | { |
98 | - $this->authorize('delete', $application); |
|
97 | + $this->authorize ('delete', $application); |
|
99 | 98 | |
100 | - $application->delete(); |
|
99 | + $application->delete (); |
|
101 | 100 | |
102 | - if ($request->ajax()) { |
|
101 | + if ($request->ajax ()) { |
|
103 | 102 | return [ |
104 | 103 | 'message' => 'Application deleted' |
105 | 104 | ]; |
106 | 105 | } |
107 | 106 | |
108 | - return redirect()->back(); |
|
107 | + return redirect ()->back (); |
|
109 | 108 | } |
110 | 109 | } |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | public function setup() : void |
22 | 22 | { |
23 | 23 | // Eloquent model to associate with this collection of views and controller actions. |
24 | - $this->crud->setModel('App\Models\Classification'); |
|
24 | + $this->crud->setModel ('App\Models\Classification'); |
|
25 | 25 | // Custom backpack route. |
26 | - $this->crud->setRoute('admin/classification'); |
|
26 | + $this->crud->setRoute ('admin/classification'); |
|
27 | 27 | // Custom strings to display within the backpack UI. |
28 | - $this->crud->setEntityNameStrings('classification', 'classifications'); |
|
28 | + $this->crud->setEntityNameStrings ('classification', 'classifications'); |
|
29 | 29 | |
30 | - $this->crud->operation(['create', 'update'], function () { |
|
31 | - $this->crud->addField([ |
|
30 | + $this->crud->operation (['create', 'update'], function (){ |
|
31 | + $this->crud->addField ([ |
|
32 | 32 | 'name' => 'key', |
33 | 33 | 'type' => 'text', |
34 | 34 | 'label' => 'Key', |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | |
39 | 39 | public function setupListOperation() |
40 | 40 | { |
41 | - $this->crud->addColumn([ |
|
41 | + $this->crud->addColumn ([ |
|
42 | 42 | 'name' => 'id', |
43 | 43 | 'type' => 'text', |
44 | 44 | 'label' => 'ID', |
45 | 45 | ]); |
46 | 46 | |
47 | - $this->crud->addColumn([ |
|
47 | + $this->crud->addColumn ([ |
|
48 | 48 | 'name' => 'key', |
49 | 49 | 'type' => 'text', |
50 | 50 | 'label' => 'Key', |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | |
54 | 54 | public function setupCreateOperation() |
55 | 55 | { |
56 | - $this->crud->setValidation(StoreRequest::class); |
|
56 | + $this->crud->setValidation (StoreRequest::class); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function setupUpdateOperation() |
60 | 60 | { |
61 | - $this->crud->setValidation(UpdateRequest::class); |
|
61 | + $this->crud->setValidation (UpdateRequest::class); |
|
62 | 62 | } |
63 | 63 | } |
@@ -26,37 +26,37 @@ discard block |
||
26 | 26 | { |
27 | 27 | // Eloquent model to associate with this collection |
28 | 28 | // of views and controller actions. |
29 | - $this->crud->setModel('App\Models\Skill'); |
|
29 | + $this->crud->setModel ('App\Models\Skill'); |
|
30 | 30 | // Custom backpack route. |
31 | - $this->crud->setRoute('admin/skill'); |
|
31 | + $this->crud->setRoute ('admin/skill'); |
|
32 | 32 | // Custom strings to display within the backpack UI, |
33 | 33 | // things like Create Skill, Delete Skills, etc. |
34 | - $this->crud->setEntityNameStrings('skill', 'skills'); |
|
34 | + $this->crud->setEntityNameStrings ('skill', 'skills'); |
|
35 | 35 | |
36 | - $this->crud->operation(['create', 'update'], function () { |
|
36 | + $this->crud->operation (['create', 'update'], function (){ |
|
37 | 37 | // Add custom fields to the create/update views. |
38 | - $this->crud->addField([ |
|
38 | + $this->crud->addField ([ |
|
39 | 39 | 'name' => 'name', |
40 | 40 | 'type' => 'text', |
41 | 41 | 'label' => 'Name', |
42 | 42 | ]); |
43 | 43 | |
44 | - $this->crud->addField([ |
|
44 | + $this->crud->addField ([ |
|
45 | 45 | 'name' => 'description', |
46 | 46 | 'type' => 'textarea', |
47 | 47 | 'label' => 'Description', |
48 | 48 | 'limit' => 70, |
49 | 49 | ]); |
50 | 50 | |
51 | - $this->crud->addField([ |
|
51 | + $this->crud->addField ([ |
|
52 | 52 | 'name' => 'skill_type_id', |
53 | 53 | 'label' => 'Type', |
54 | 54 | 'type' => 'select_from_array', |
55 | - 'options' => SkillType::all()->pluck('name', 'id')->toArray(), |
|
55 | + 'options' => SkillType::all ()->pluck ('name', 'id')->toArray (), |
|
56 | 56 | 'allow_null' => false, |
57 | 57 | ]); |
58 | 58 | |
59 | - $this->crud->addField([ |
|
59 | + $this->crud->addField ([ |
|
60 | 60 | 'name' => 'classifications', |
61 | 61 | 'type' => 'select2_multiple', |
62 | 62 | 'label' => 'Classifications (select all that apply)', |
@@ -66,13 +66,13 @@ discard block |
||
66 | 66 | 'pivot' => true, |
67 | 67 | ]); |
68 | 68 | |
69 | - $this->crud->addField([ |
|
69 | + $this->crud->addField ([ |
|
70 | 70 | 'name' => 'is_culture_skill', |
71 | 71 | 'label' => 'This is a culture skill', |
72 | 72 | 'type' => 'checkbox' |
73 | 73 | ]); |
74 | 74 | |
75 | - $this->crud->addField([ |
|
75 | + $this->crud->addField ([ |
|
76 | 76 | 'name' => 'is_future_skill', |
77 | 77 | 'label' => 'This is a future skill', |
78 | 78 | 'type' => 'checkbox' |
@@ -85,56 +85,56 @@ discard block |
||
85 | 85 | // Workaround for how the unique_translation validation |
86 | 86 | // works in App\Http\Requests\SkillCrudRequest. |
87 | 87 | $locale = 'en'; |
88 | - if (null !== $this->request->input('locale')) { |
|
89 | - $locale = $this->request->input('locale'); |
|
88 | + if (null !== $this->request->input ('locale')) { |
|
89 | + $locale = $this->request->input ('locale'); |
|
90 | 90 | } |
91 | - App::setLocale($locale); |
|
91 | + App::setLocale ($locale); |
|
92 | 92 | |
93 | 93 | // Remove delete button. |
94 | - $this->crud->removeButton('delete'); |
|
94 | + $this->crud->removeButton ('delete'); |
|
95 | 95 | |
96 | 96 | // Add custom columns to the Skill index view. |
97 | - $this->crud->addColumn([ |
|
97 | + $this->crud->addColumn ([ |
|
98 | 98 | 'name' => 'id', |
99 | 99 | 'type' => 'text', |
100 | 100 | 'label' => 'ID', |
101 | 101 | 'orderable' => true |
102 | 102 | ]); |
103 | 103 | |
104 | - $this->crud->addColumn([ |
|
104 | + $this->crud->addColumn ([ |
|
105 | 105 | 'name' => 'name', |
106 | 106 | 'type' => 'text', |
107 | 107 | 'label' => 'Name', |
108 | 108 | 'searchLogic' => function ($query, $column, $searchTerm) use ($locale) : void { |
109 | - $query->orWhere('name->' . $locale, 'like', "%$searchTerm%"); |
|
109 | + $query->orWhere ('name->'.$locale, 'like', "%$searchTerm%"); |
|
110 | 110 | }, |
111 | 111 | 'orderLogic' => function ($query, $column, $columnDirection) use ($locale) { |
112 | - return $query->orderBy('name->' . $locale, $columnDirection)->select('*'); |
|
112 | + return $query->orderBy ('name->'.$locale, $columnDirection)->select ('*'); |
|
113 | 113 | } |
114 | 114 | ]); |
115 | 115 | |
116 | - $this->crud->addColumn([ |
|
116 | + $this->crud->addColumn ([ |
|
117 | 117 | 'name' => 'description', |
118 | 118 | 'type' => 'text', |
119 | 119 | 'label' => 'Description', |
120 | 120 | 'searchLogic' => function ($query, $column, $searchTerm) use ($locale) : void { |
121 | - $query->orWhere('description->' . $locale, 'like', "%$searchTerm%"); |
|
121 | + $query->orWhere ('description->'.$locale, 'like', "%$searchTerm%"); |
|
122 | 122 | }, |
123 | 123 | 'orderable' => false, |
124 | 124 | ]); |
125 | 125 | |
126 | - $this->crud->addColumn([ |
|
126 | + $this->crud->addColumn ([ |
|
127 | 127 | 'name' => 'skill_type.name', |
128 | 128 | 'key' => 'skill_type_name', |
129 | 129 | 'type' => 'text', |
130 | 130 | 'label' => 'Type', |
131 | 131 | 'orderable' => true, |
132 | 132 | 'orderLogic' => function ($query, $column, $columnDirection) use ($locale) { |
133 | - return $query->orderBy('skill_type_id', $columnDirection)->select('*'); |
|
133 | + return $query->orderBy ('skill_type_id', $columnDirection)->select ('*'); |
|
134 | 134 | } |
135 | 135 | ]); |
136 | 136 | |
137 | - $this->crud->addColumn([ |
|
137 | + $this->crud->addColumn ([ |
|
138 | 138 | 'label' => 'Classifications', |
139 | 139 | 'type' => 'select_multiple', |
140 | 140 | 'name' => 'classifications', |
@@ -143,14 +143,14 @@ discard block |
||
143 | 143 | 'model' => 'App\Models\Skill', |
144 | 144 | ]); |
145 | 145 | |
146 | - $this->crud->addColumn([ |
|
146 | + $this->crud->addColumn ([ |
|
147 | 147 | 'name' => 'is_culture_skill', |
148 | 148 | 'label' => 'Culture', |
149 | 149 | 'type' => 'boolean', |
150 | 150 | 'orderable' => true, |
151 | 151 | ]); |
152 | 152 | |
153 | - $this->crud->addColumn([ |
|
153 | + $this->crud->addColumn ([ |
|
154 | 154 | 'name' => 'is_future_skill', |
155 | 155 | 'label' => 'Future', |
156 | 156 | 'type' => 'boolean', |
@@ -158,44 +158,44 @@ discard block |
||
158 | 158 | ]); |
159 | 159 | |
160 | 160 | // Add select2_multiple filter for classifications. |
161 | - $this->crud->addFilter([ |
|
161 | + $this->crud->addFilter ([ |
|
162 | 162 | 'name' => 'classifications', |
163 | 163 | 'key' => 'classifications_filter', |
164 | 164 | 'type' => 'select2_multiple', |
165 | 165 | 'label' => 'Filter by classification' |
166 | - ], function () { |
|
166 | + ], function (){ |
|
167 | 167 | // The options that show up in the select2. |
168 | - return Classification::all()->pluck('key', 'id')->toArray(); |
|
169 | - }, function ($values) { |
|
168 | + return Classification::all ()->pluck ('key', 'id')->toArray (); |
|
169 | + }, function ($values){ |
|
170 | 170 | // If the filter is active. |
171 | - foreach (json_decode($values) as $key => $value) { |
|
172 | - $this->crud->query = $this->crud->query->whereHas('classifications', function ($query) use ($value) { |
|
173 | - $query->where('id', $value); |
|
171 | + foreach (json_decode ($values) as $key => $value) { |
|
172 | + $this->crud->query = $this->crud->query->whereHas ('classifications', function ($query) use ($value) { |
|
173 | + $query->where ('id', $value); |
|
174 | 174 | }); |
175 | 175 | } |
176 | 176 | }); |
177 | 177 | |
178 | 178 | // Add filter for skills without classifications. |
179 | - $this->crud->addFilter( |
|
179 | + $this->crud->addFilter ( |
|
180 | 180 | [ |
181 | 181 | 'type' => 'simple', |
182 | 182 | 'name' => 'noClassification', |
183 | 183 | 'label'=> 'No classification' |
184 | 184 | ], |
185 | 185 | false, |
186 | - function () { |
|
187 | - $this->crud->query = $this->crud->query->doesntHave('classifications'); |
|
186 | + function (){ |
|
187 | + $this->crud->query = $this->crud->query->doesntHave ('classifications'); |
|
188 | 188 | } |
189 | 189 | ); |
190 | 190 | } |
191 | 191 | |
192 | 192 | public function setupCreateOperation() |
193 | 193 | { |
194 | - $this->crud->setValidation(StoreRequest::class); |
|
194 | + $this->crud->setValidation (StoreRequest::class); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | public function setupUpdateOperation() |
198 | 198 | { |
199 | - $this->crud->setValidation(UpdateRequest::class); |
|
199 | + $this->crud->setValidation (UpdateRequest::class); |
|
200 | 200 | } |
201 | 201 | } |