<?php
require_once 'vendor/autoload.php';

$app = require_once 'bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();

use App\Models\Product;

echo "=== Test d'affichage des images des produits ===\n\n";

$products = Product::take(5)->get();

foreach ($products as $product) {
    echo "ID: {$product->id}\n";
    echo "Nom: {$product->name}\n";
    echo "Image (accessor): {$product->image}\n";
    echo "Image URL: {$product->image_url}\n";
    
    // Vérifier si le fichier existe
    $publicPath = public_path('storage/' . $product->image);
    echo "Fichier existe: " . (file_exists($publicPath) ? "OUI" : "NON") . " ($publicPath)\n";
    echo str_repeat("-", 60) . "\n";
}
