1
1
<?php
2
2
3
-
4
3
namespace App \Http \Controllers \Frontend \Page ;
5
4
6
- use App \Models \Map ;
7
- use App \Models \Info ;
8
- use App \Models \User ;
9
- use App \Models \About ;
10
- use App \Models \Banner ;
11
- use App \Models \Course ;
12
- use App \Models \Review ;
13
5
use App \Enums \PageName ;
14
- use App \Models \ Industry ;
15
- use App \Models \Purchase ;
6
+ use App \Http \ Controllers \ Controller ;
7
+ use App \Models \About ;
16
8
use App \Models \Achievement ;
17
9
use App \Models \Appointment ;
18
- use App \Models \Testimonial ;
10
+ use App \Models \Banner ;
19
11
use App \Models \ClientStudio ;
20
- use Illuminate \Http \Request ;
21
12
use App \Models \CustomService ;
22
13
use App \Models \ExpertProfile ;
14
+ use App \Models \Info ;
15
+ use App \Models \Map ;
23
16
use App \Models \PartnerSection ;
17
+ use App \Models \Purchase ;
24
18
use App \Models \ServiceSubCategory ;
25
- use App \Http \Controllers \Controller ;
19
+ use App \Models \User ;
20
+ use Illuminate \Database \Eloquent \Builder ;
21
+ use Illuminate \Http \Request ;
26
22
use Illuminate \Support \Facades \Auth ;
27
23
28
24
class PageController extends Controller
@@ -33,33 +29,40 @@ public function trainingPage()
33
29
}
34
30
public function industriesPage ()
35
31
{
36
- $ subCategories = ServiceSubCategory::with ('serviceCategory ' )->where ('service_category_id ' , 3 )->get ();
37
- $ achievements = Achievement::latest ()->get ();
38
- $ partners = PartnerSection::latest ()->limit (10 )->get ();
32
+ $ subCategories = ServiceSubCategory::with ('serviceCategory ' )->where ('service_category_id ' , 3 )->get ();
33
+ $ achievements = Achievement::latest ()->get ();
34
+ $ partners = PartnerSection::latest ()->limit (10 )->get ();
39
35
$ customServices = CustomService::with ('image ' )->where ('page_name ' , PageName::Account)->get ();
40
36
return view ('frontend.pages.industries.industries ' , compact ('subCategories ' , 'achievements ' , 'partners ' , 'customServices ' ));
41
37
}
42
38
public function clientStudioPage ()
43
39
{
44
- $ data = ClientStudio::get ();
45
- $ description = $ data [0 ]->description ;
40
+ $ data = ClientStudio::get ();
41
+ $ description = $ data [ 0 ]->description ;
46
42
$ appointmentSections = Appointment::latest ()->limit (5 )->get ();
47
- $ banners = Banner::latest ()->limit (10 )->get ();
48
- $ partners = PartnerSection::latest ()->limit (10 )->get ();
43
+ $ banners = Banner::latest ()->limit (10 )->get ();
44
+ $ partners = PartnerSection::latest ()->limit (10 )->get ();
49
45
return view ('frontend.pages.clientStudio.clientStudio ' , compact ('data ' , 'description ' , 'appointmentSections ' , 'banners ' , 'partners ' ));
50
46
}
51
- public function appointmentPage (?ExpertProfile $ expertProfile = null )
47
+ public function appointmentPage (Request $ request , ?ExpertProfile $ expertProfile = null )
52
48
{
53
- $ maps = Map::get ();
54
- $ banners = getRecords ('banners ' );
55
- $ infos1 = Info::where ('section_id ' , 1 )->get ();
49
+ $ maps = Map::where (function (Builder $ q ) use ($ request ) {
50
+ if ($ request ->query ('branch-thana ' )) {
51
+ $ q ->where ('thana ' , $ request ->query ('branch-thana ' ));
52
+ }
53
+ if ($ request ->query ('branch-district ' )) {
54
+ $ q ->where ('district ' , $ request ->query ('branch-district ' ));
55
+ }
56
+ })->get ();
57
+ $ banners = getRecords ('banners ' );
58
+ $ infos1 = Info::where ('section_id ' , 1 )->get ();
56
59
$ testimonials = \App \Models \Review::with ('user ' )->latest ()->limit (10 )->get ();
57
60
return view ('frontend.pages.appointment.makeAppointment ' , compact ('banners ' , 'expertProfile ' , 'infos1 ' , 'testimonials ' , 'maps ' ));
58
61
}
59
62
public function appointmentVirtual (?ExpertProfile $ expertProfile = null )
60
63
{
61
- $ banners = getRecords ('banners ' );
62
- $ infos1 = Info::where ('section_id ' , 1 )->get ();
64
+ $ banners = getRecords ('banners ' );
65
+ $ infos1 = Info::where ('section_id ' , 1 )->get ();
63
66
$ testimonials = \App \Models \Review::with ('user ' )->latest ()->limit (10 )->get ();
64
67
return view ('frontend.pages.appointment.makeAppointmentVirtual ' , compact ('banners ' , 'expertProfile ' , 'testimonials ' , 'infos1 ' ));
65
68
}
@@ -68,18 +71,25 @@ public function aboutPage()
68
71
$ about = About::first ();
69
72
return view ('frontend.pages.about ' , compact ('about ' ));
70
73
}
71
- function officePage ()
74
+ public function officePage (Request $ request )
72
75
{
73
- $ maps = Map::get ();
76
+ $ maps = Map::where (function (Builder $ q ) use ($ request ) {
77
+ if ($ request ->query ('branch-thana ' )) {
78
+ $ q ->where ('thana ' , $ request ->query ('branch-thana ' ));
79
+ }
80
+ if ($ request ->query ('branch-district ' )) {
81
+ $ q ->where ('district ' , $ request ->query ('branch-district ' ));
82
+ }
83
+ })->get ();
74
84
$ districts = Map::select ('district ' )->distinct ()->get ()->pluck ('district ' );
75
- $ thanas = Map::select ('thana ' )->distinct ()->get ()->pluck ('thana ' );
85
+ $ thanas = Map::select ('thana ' )->distinct ()->get ()->pluck ('thana ' );
76
86
return view ('frontend.pages.office ' , compact ('maps ' , 'districts ' , 'thanas ' ));
77
87
}
78
- function contactPage ()
88
+ public function contactPage ()
79
89
{
80
- $ maps = Map::get ();
90
+ $ maps = Map::get ();
81
91
$ appointmentSections = Appointment::latest ()->limit (5 )->get ();
82
- $ partners = PartnerSection::latest ()->limit (10 )->get ();
92
+ $ partners = PartnerSection::latest ()->limit (10 )->get ();
83
93
return view ('frontend.pages.contact ' , compact ('maps ' , 'appointmentSections ' , 'partners ' ));
84
94
}
85
95
public function becomePartnerPage ()
@@ -91,7 +101,7 @@ public function becomePartnerPage()
91
101
//promo codes view page
92
102
public function PromoCodePage ()
93
103
{
94
- $ user_id = Auth::user ()->id ;
104
+ $ user_id = Auth::user ()->id ;
95
105
$ promoCodes = User::find ($ user_id )->promoCodes ()->where ('status ' , 1 )->get ();
96
106
return view ('frontend.pages.promoCodesPage ' , compact ('promoCodes ' ));
97
107
}
@@ -102,11 +112,10 @@ public function notificationPage()
102
112
return view ('frontend.pages.notificationPage ' );
103
113
}
104
114
105
-
106
115
//show all my courses in frontend
107
116
public function myCourses ()
108
117
{
109
- $ user = User::where ('id ' , auth ()->id ())->first ();
118
+ $ user = User::where ('id ' , auth ()->id ())->first ();
110
119
$ courses = $ user ->purchased ('course ' );
111
120
return view ('frontend.pages.myCourses ' , compact ('courses ' ));
112
121
}
@@ -124,7 +133,8 @@ public function contactDevelopers()
124
133
}
125
134
126
135
//shwo payment history
127
- public function myPaymentShow ($ id ){
136
+ public function myPaymentShow ($ id )
137
+ {
128
138
$ history = Purchase::find ($ id )->where ('user_id ' , auth ()->id ())->first ();
129
139
return view ('frontend.pages.myPaymentShow ' , compact ('history ' ));
130
140
}
0 commit comments