<?php

namespace App\Http\Controllers\website;

use App\Http\Controllers\Controller;
use App\Models\UserProfile;
use Illuminate\Support\Facades\Auth; // Import Auth Facade

use Illuminate\Http\Request;

class HomeController extends Controller
{
  public function index()
{
   $bookCovers = UserProfile::whereNotNull('book_cover')->get();
$countries = $bookCovers->pluck('country')->unique()->sort()->values();



return view('website.index', compact('bookCovers', 'countries'));



        // $userId = Auth::id();

        // Fetch the book covers for the logged-in user
        // $bookCovers = UserProfile::where('user_id', $userId)
        //                          ->whereNotNull('book_cover')
        //                          ->pluck('book_cover');  // Get only the book_cover field

        // return view('website.index', compact('bookCovers'));
    }
}
