1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Http\ViewComposers; |
4
|
|
|
|
5
|
|
|
use Illuminate\View\View; |
6
|
|
|
use Illuminate\Support\Facades\Lang; |
7
|
|
|
use Illuminate\Support\Facades\Auth; |
8
|
|
|
use Illuminate\Support\Facades\Route; |
9
|
|
|
|
10
|
|
|
class ApplicantProfileMenuComposer |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* Bind data to the view. |
14
|
|
|
* |
15
|
|
|
* @param View $view |
16
|
|
|
* @return void |
17
|
|
|
*/ |
18
|
1 |
|
public function compose(View $view) |
19
|
|
|
{ |
20
|
1 |
|
$profileMenu = Lang::get('applicant/applicant_profile_menu'); |
21
|
|
|
|
22
|
1 |
|
$profileMenu['items']['about']['link'] = route('profile.about.edit', $view->getData()['applicant']); |
|
|
|
|
23
|
1 |
|
$profileMenu['items']['experience']['link'] = route('profile.experience.edit', $view->getData()['applicant']); |
24
|
1 |
|
$profileMenu['items']['skills']['link'] = route('profile.skills.edit', $view->getData()['applicant']); |
25
|
1 |
|
$profileMenu['items']['skills-old']['link'] = route('profile.skills-old.edit', $view->getData()['applicant']); |
26
|
1 |
|
$profileMenu['items']['references']['link'] = route('profile.references.edit', $view->getData()['applicant']); |
27
|
|
|
$profileMenu['items']['portfolio']['link'] = route('profile.work_samples.edit', $view->getData()['applicant']); |
28
|
|
|
|
29
|
1 |
|
// Set archive variable to group sidebar |
30
|
1 |
|
$profileMenu['items']['about']['archive'] = true; |
31
|
1 |
|
$profileMenu['items']['experience']['archive'] = false; |
32
|
1 |
|
$profileMenu['items']['skills-old']['archive'] = true; |
33
|
|
|
$profileMenu['items']['references']['archive'] = true; |
34
|
|
|
$profileMenu['items']['portfolio']['archive'] = true; |
35
|
1 |
|
|
36
|
1 |
|
// Set active on the proper item |
37
|
1 |
|
switch (Route::currentRouteName()) { |
38
|
|
|
case ('profile.about'): |
39
|
|
|
case ('profile.about.edit'): |
40
|
1 |
|
$profileMenu['items']['about']['active'] = true; |
41
|
1 |
|
break; |
42
|
|
|
case ('profile.experience'): |
43
|
|
|
case ('profile.experience.edit'): |
44
|
1 |
|
$profileMenu['items']['experience']['active'] = true; |
45
|
1 |
|
break; |
46
|
1 |
|
case ('profile.skills'): |
47
|
1 |
|
case ('profile.skills.edit'): |
48
|
|
|
$profileMenu['items']['skills']['active'] = true; |
49
|
|
|
break; |
50
|
|
|
case ('profile.skills-old'): |
51
|
|
|
case ('profile.skills-old.edit'): |
52
|
|
|
$profileMenu['items']['skills-old']['active'] = true; |
53
|
|
|
break; |
54
|
|
|
case ('profile.references'): |
55
|
|
|
case ('profile.references.edit'): |
56
|
|
|
$profileMenu['items']['references']['active'] = true; |
57
|
1 |
|
break; |
58
|
1 |
|
case ('profile.portfolio'): |
59
|
|
|
case ('profile.work_samples.edit'): |
60
|
|
|
$profileMenu['items']['portfolio']['active'] = true; |
61
|
|
|
break; |
62
|
|
|
default: |
63
|
|
|
// No active menu item |
64
|
|
|
break; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
$view->with('profile_menu', $profileMenu); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|