This repository has been archived by the owner on Mar 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dynamic home pg content: popular services and deals
Last commit of 2023 : )
- Loading branch information
1 parent
d401b5f
commit dae8163
Showing
4 changed files
with
57 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
class HomePageController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
|
||
$deals = \App\Models\Deal::where('end_date', '>', 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')); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters