Skip to content

Commit 20747ae

Browse files
committed
fix sidebar with map
1 parent 1ab978a commit 20747ae

File tree

8 files changed

+613
-339
lines changed

8 files changed

+613
-339
lines changed

app/Http/Controllers/Frontend/Page/PageController.php

+46-36
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
<?php
22

3-
43
namespace App\Http\Controllers\Frontend\Page;
54

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;
135
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;
168
use App\Models\Achievement;
179
use App\Models\Appointment;
18-
use App\Models\Testimonial;
10+
use App\Models\Banner;
1911
use App\Models\ClientStudio;
20-
use Illuminate\Http\Request;
2112
use App\Models\CustomService;
2213
use App\Models\ExpertProfile;
14+
use App\Models\Info;
15+
use App\Models\Map;
2316
use App\Models\PartnerSection;
17+
use App\Models\Purchase;
2418
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;
2622
use Illuminate\Support\Facades\Auth;
2723

2824
class PageController extends Controller
@@ -33,33 +29,40 @@ public function trainingPage()
3329
}
3430
public function industriesPage()
3531
{
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();
3935
$customServices = CustomService::with('image')->where('page_name', PageName::Account)->get();
4036
return view('frontend.pages.industries.industries', compact('subCategories', 'achievements', 'partners', 'customServices'));
4137
}
4238
public function clientStudioPage()
4339
{
44-
$data = ClientStudio::get();
45-
$description = $data[0]->description;
40+
$data = ClientStudio::get();
41+
$description = $data[ 0 ]->description;
4642
$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();
4945
return view('frontend.pages.clientStudio.clientStudio', compact('data', 'description', 'appointmentSections', 'banners', 'partners'));
5046
}
51-
public function appointmentPage(?ExpertProfile $expertProfile = null)
47+
public function appointmentPage(Request $request , ?ExpertProfile $expertProfile = null)
5248
{
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();
5659
$testimonials = \App\Models\Review::with('user')->latest()->limit(10)->get();
5760
return view('frontend.pages.appointment.makeAppointment', compact('banners', 'expertProfile', 'infos1', 'testimonials', 'maps'));
5861
}
5962
public function appointmentVirtual(?ExpertProfile $expertProfile = null)
6063
{
61-
$banners = getRecords('banners');
62-
$infos1 = Info::where('section_id', 1)->get();
64+
$banners = getRecords('banners');
65+
$infos1 = Info::where('section_id', 1)->get();
6366
$testimonials = \App\Models\Review::with('user')->latest()->limit(10)->get();
6467
return view('frontend.pages.appointment.makeAppointmentVirtual', compact('banners', 'expertProfile', 'testimonials', 'infos1'));
6568
}
@@ -68,18 +71,25 @@ public function aboutPage()
6871
$about = About::first();
6972
return view('frontend.pages.about', compact('about'));
7073
}
71-
function officePage()
74+
public function officePage(Request $request)
7275
{
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();
7484
$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');
7686
return view('frontend.pages.office', compact('maps', 'districts', 'thanas'));
7787
}
78-
function contactPage()
88+
public function contactPage()
7989
{
80-
$maps = Map::get();
90+
$maps = Map::get();
8191
$appointmentSections = Appointment::latest()->limit(5)->get();
82-
$partners = PartnerSection::latest()->limit(10)->get();
92+
$partners = PartnerSection::latest()->limit(10)->get();
8393
return view('frontend.pages.contact', compact('maps', 'appointmentSections', 'partners'));
8494
}
8595
public function becomePartnerPage()
@@ -91,7 +101,7 @@ public function becomePartnerPage()
91101
//promo codes view page
92102
public function PromoCodePage()
93103
{
94-
$user_id = Auth::user()->id;
104+
$user_id = Auth::user()->id;
95105
$promoCodes = User::find($user_id)->promoCodes()->where('status', 1)->get();
96106
return view('frontend.pages.promoCodesPage', compact('promoCodes'));
97107
}
@@ -102,11 +112,10 @@ public function notificationPage()
102112
return view('frontend.pages.notificationPage');
103113
}
104114

105-
106115
//show all my courses in frontend
107116
public function myCourses()
108117
{
109-
$user = User::where('id', auth()->id())->first();
118+
$user = User::where('id', auth()->id())->first();
110119
$courses = $user->purchased('course');
111120
return view('frontend.pages.myCourses', compact('courses'));
112121
}
@@ -124,7 +133,8 @@ public function contactDevelopers()
124133
}
125134

126135
//shwo payment history
127-
public function myPaymentShow($id){
136+
public function myPaymentShow($id)
137+
{
128138
$history = Purchase::find($id)->where('user_id', auth()->id())->first();
129139
return view('frontend.pages.myPaymentShow', compact('history'));
130140
}

0 commit comments

Comments
 (0)