mirror of
https://github.com/openclassify/openclassify.git
synced 2026-04-14 11:12:09 -05:00
- Added routes for user profile management including edit, update, and delete functionalities. - Created ProfileController to handle profile-related requests. - Introduced Profile model to manage user profile data. - Developed user status states (Active, Banned, Suspended) with appropriate labels and descriptions. - Implemented favorite listings and sellers functionality in the User model. - Created views for profile editing, updating password, and deleting account. - Added migration for user and profile tables along with necessary fields. - Registered User module with service provider and routes.
34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Modules\Listing\Models\Listing;
|
|
use Modules\Category\Models\Category;
|
|
use Modules\User\App\Models\User;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function index()
|
|
{
|
|
$categories = Category::whereNull('parent_id')->where('is_active', true)->get();
|
|
$featuredListings = Listing::where('status', 'active')->where('is_featured', true)->latest()->take(4)->get();
|
|
$recentListings = Listing::where('status', 'active')->latest()->take(8)->get();
|
|
$listingCount = Listing::where('status', 'active')->count();
|
|
$categoryCount = Category::where('is_active', true)->count();
|
|
$userCount = User::count();
|
|
$favoriteListingIds = auth()->check()
|
|
? auth()->user()->favoriteListings()->pluck('listings.id')->all()
|
|
: [];
|
|
|
|
return view('home', compact(
|
|
'categories',
|
|
'featuredListings',
|
|
'recentListings',
|
|
'listingCount',
|
|
'categoryCount',
|
|
'userCount',
|
|
'favoriteListingIds',
|
|
));
|
|
}
|
|
}
|