@extends('layouts.app') @php $title = 'Discover Products - ' . config('app.name'); @endphp @section('content')

Discover Products

@auth Submit a Product @endauth
@if(request()->hasAny(['search', 'category', 'date_range', 'sort']))
Active Filters: @if(request('search')) Search: "{{ request('search') }}" @endif @if(request('category')) Category: {{ $categories->find(request('category'))->name ?? 'Unknown' }} @endif @if(request('date_range')) Period: {{ ucfirst(request('date_range')) }} @endif @if(request('sort') && request('sort') !== 'newest') Sort: {{ ucfirst(request('sort')) }} @endif
@endif
@if(session('success')) @endif @if($products->total() > 0)

Showing {{ $products->firstItem() }} to {{ $products->lastItem() }} of {{ $products->total() }} product(s)

@endif
@forelse($products as $product)
@if($product->thumbnail_url) {{ $product->title }} @else
No image
@endif
{{ $product->title }}
@if(isset($product->upvotes_count)) {{ $product->upvotes_count }} @endif

{{ $product->category->name }}

{{ Str::limit($product->description, 100) }}

By {{ $product->user->name }} ยท {{ $product->created_at->diffForHumans() }}
@empty
@if(request()->hasAny(['search', 'category', 'date_range'])) No products found matching your filters. Try adjusting your search criteria. @else No products found. Be the first to submit one! @endif
@endforelse
@if($products->hasPages())
{{ $products->links() }}
@endif
@endsection