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
|
|
|
public function compose(View $view) |
19
|
|
|
{ |
20
|
|
|
$profileMenu = [ |
21
|
|
|
"about" => [ |
22
|
|
|
"active" => false, |
23
|
|
|
"link" => route('profile.about.edit', $view->getData()['applicant']), |
24
|
|
|
"title" => "Go to the About Me section of your profile.", |
25
|
|
|
"label" => "About Me" |
26
|
|
|
], |
27
|
|
|
"experience" => [ |
28
|
|
|
"active" => false, |
29
|
|
|
"link" => route('profile.experience.edit', $view->getData()['applicant']), |
30
|
|
|
"title" => "Go to the Experience section of your profile.", |
31
|
|
|
"label" => "My Experience" |
32
|
|
|
], |
33
|
|
|
"skills" => [ |
34
|
|
|
"active" => false, |
35
|
|
|
"link" => "/profile/skills", |
36
|
|
|
"title" => "Go to the Skills section of your profile.", |
37
|
|
|
"label" => "My Skills" |
38
|
|
|
], |
39
|
|
|
"references" => [ |
40
|
|
|
"active" => false, |
41
|
|
|
"link" => "/profile/references", |
42
|
|
|
"title" => "Go to the References section of your profile.", |
43
|
|
|
"label" => "My References" |
44
|
|
|
], |
45
|
|
|
"portfolio" => [ |
46
|
|
|
"active" => false, |
47
|
|
|
"link" => "/profile/portfolio", |
48
|
|
|
"title" => "Go to the Portfolio section of your profile.", |
49
|
|
|
"label" => "My Portfolio" |
50
|
|
|
] |
51
|
|
|
]; |
52
|
|
|
|
53
|
|
|
//Set active on the proper item |
54
|
|
|
switch(Route::currentRouteName()) { |
55
|
|
|
case('profile.about'): |
56
|
|
|
case('profile.about.edit'): |
57
|
|
|
$profileMenu['about']['active'] = true; |
58
|
|
|
break; |
59
|
|
|
case('profile.experience'): |
60
|
|
|
case('profile.experience.edit'): |
61
|
|
|
$profileMenu['experience']['active'] = true; |
62
|
|
|
break; |
63
|
|
|
case('profile.skills'): |
64
|
|
|
case('profile.skills.edit'): |
65
|
|
|
$profileMenu['skills']['active'] = true; |
66
|
|
|
break; |
67
|
|
|
case('profile.references'): |
68
|
|
|
case('profile.references.edit'): |
69
|
|
|
$profileMenu['references']['active'] = true; |
70
|
|
|
break; |
71
|
|
|
case('profile.portfolio'): |
72
|
|
|
case('profile.portfolio.edit'): |
73
|
|
|
$profileMenu['portfolio']['active'] = true; |
74
|
|
|
break; |
75
|
|
|
default: |
76
|
|
|
//No active menu item |
77
|
|
|
break; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
$view->with('profile_menu', $profileMenu); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|