mirror of
https://github.com/openclassify/openclassify.git
synced 2026-04-14 11:12:09 -05:00
35 lines
959 B
PHP
35 lines
959 B
PHP
<?php
|
|
|
|
namespace Modules\Site\App\Http\Controllers;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Modules\Category\Models\Category;
|
|
use Modules\Listing\Models\Listing;
|
|
use Modules\User\App\Models\User;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$categories = Category::homeParentCategories();
|
|
$featuredListings = Listing::homeFeatured();
|
|
$recentListings = Listing::homeRecent();
|
|
$listingCount = Listing::activeCount();
|
|
$categoryCount = Category::activeCount();
|
|
$userCount = User::totalCount();
|
|
$favoriteListingIds = auth()->check()
|
|
? auth()->user()->homeFavoriteListingIds()
|
|
: [];
|
|
|
|
return view('site::home', compact(
|
|
'categories',
|
|
'featuredListings',
|
|
'recentListings',
|
|
'listingCount',
|
|
'categoryCount',
|
|
'userCount',
|
|
'favoriteListingIds',
|
|
));
|
|
}
|
|
}
|