lots of design improvements

This commit is contained in:
Doar Mihai
2026-02-14 16:11:09 +02:00
parent 56b593d9ca
commit 67de095a03
25 changed files with 1942 additions and 1477 deletions
@@ -11,6 +11,42 @@ use Illuminate\Support\Facades\Storage;
class ProductController extends Controller
{
/**
* Display the homepage with featured products.
*/
public function homepage()
{
// Get trending products (most upvoted in the last 7 days)
$trendingProducts = Product::query()
->with(['user', 'category'])
->approved()
->where('created_at', '>=', now()->subDays(7))
->withCount('upvotes')
->orderBy('upvotes_count', 'desc')
->limit(6)
->get();
// Get recently added products
$recentProducts = Product::query()
->with(['user', 'category'])
->approved()
->latest()
->limit(12)
->get();
// Get popular categories with product counts
$categories = Category::query()
->withCount(['products' => function($query) {
$query->approved();
}])
->having('products_count', '>', 0)
->orderBy('products_count', 'desc')
->limit(8)
->get();
return view('welcome', compact('trendingProducts', 'recentProducts', 'categories'));
}
/**
* Display a listing of the products.
*/