diff --git a/app/Http/Controllers/HomePageController.php b/app/Http/Controllers/HomePageController.php new file mode 100644 index 0000000..ebc0fac --- /dev/null +++ b/app/Http/Controllers/HomePageController.php @@ -0,0 +1,26 @@ +', now()) + ->where('is_hidden', false) + ->orderBy('end_date', 'asc') + ->take(3) + ->get(); + + // get the top 3 popular services using most bookings in the last 30 days + $popularServices = \App\Models\Service::withCount('appointments') + ->orderBy('appointments_count', 'desc') + ->take(3) + ->where('is_hidden', false) + ->get(); + + + return view('web.home', compact('deals', 'popularServices')); + } +} diff --git a/database/database.sqlite b/database/database.sqlite index 6663c32..fe09c9a 100644 Binary files a/database/database.sqlite and b/database/database.sqlite differ diff --git a/resources/views/web/home.blade.php b/resources/views/web/home.blade.php index b8fa1c4..eebc196 100644 --- a/resources/views/web/home.blade.php +++ b/resources/views/web/home.blade.php @@ -89,76 +89,20 @@ class="block w-full rounded bg-white px-12 py-3 text-lg font-medium text-pink-50
- -
- Product Image -
-

Hair Cut

-

Types of hair cuts available: Layered, Bangs, Pixie cut.

- -
-
-
-

LKR 3,600.00

-

LKR 4,000.00

-
-

10% off

-
- - Book Now - -
-
-
- - -
- Product Image -
-

Hair Coloring

-

Get your hair colored by our professional hair stylists.

- -
-
-
-

LKR 3,600.00

-

LKR 4,000.00

-
-

10% off

-
- - Book Now - -
-
-
- -
- Product Image -
-

Nail Coloring

-

Keep those fingernails stylish

- -
-
-
-

LKR 3,600.00

-

LKR 4,000.00

-
-

10% off

-
- - Book Now - -
-
-
+ @if($popularServices->count() > 0) + @foreach ($popularServices as $service) + + @endforeach + @else +

+ No Services Found +

+ @endif
- View price list View All Services @@ -172,8 +116,6 @@ class="block w-full rounded bg-pink-500 px-12 py-3 text-lg font-medium text-whit > Browse Services --}} - -
@@ -181,45 +123,29 @@ class="block w-full rounded bg-pink-500 px-12 py-3 text-lg font-medium text-whit
Offers
-
- -
15% Off for Combank Credit Cards
-
-

Offer Valid till 30th Of July 2023

- - View Offer - - -
- -
- -
12% Off for Promo Code: HAIR2023
-
-

Offer Valid till 30th Of July 2023

- - View Offer - - -
- -
- -
15% Off for Frimi
-
-

Offer Valid till 30th Of July 2023

- - View Offer - - -
- + @if($deals->count() > 0) + @foreach($deals as $deal) + @if($deal->is_hidden == false) +
+ +
{{ $deal->name }}
+
+

{{ $deal->description }}

+ + View Offer + + +
+ @endif + @endforeach + @else +

+ No Deals Found +

+ @endif
- - - {{-- Gallery --}}
diff --git a/routes/web.php b/routes/web.php index b33ef28..0a80414 100644 --- a/routes/web.php +++ b/routes/web.php @@ -18,9 +18,8 @@ //Route::get('/test', [App\Http\Controllers\AdminDashboardHome::class, 'index'])->name('test'); -Route::get('/', function () { - return view('web.home'); -})->name('home'); +Route::get('/', [App\Http\Controllers\HomePageController::class, 'index'])->name('home'); + Route::get('/services', [App\Http\Controllers\DisplayService::class, 'index'])->name('services'); Route::get('/services/{slug}', [App\Http\Controllers\DisplayService::class, 'show'])->name('view-service');