<?php

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

use App\Models\Category;

$images = [
    "Oil & Ghee" => "https://images.unsplash.com/photo-1474979266404-7eaacbad7391?auto=format&fit=crop&q=80&w=800",
    "Organic" => "https://images.unsplash.com/photo-1542831371-d531d36971e6?auto=format&fit=crop&q=80&w=800",
    "Honey" => "https://images.unsplash.com/photo-1584622650111-993a426fbf0a?auto=format&fit=crop&q=80&w=800",
    "Dates" => "https://images.unsplash.com/photo-1520038410233-7141be7e6f97?auto=format&fit=crop&q=80&w=800",
    "Spices" => "https://images.unsplash.com/photo-1532336414038-cf19250c5757?auto=format&fit=crop&q=80&w=800",
    "Nuts & Seeds" => "https://images.unsplash.com/photo-1536620464240-987dc621f612?auto=format&fit=crop&q=80&w=800",
    "Beverage" => "https://images.unsplash.com/photo-1544145945-f904253db0ad?auto=format&fit=crop&q=80&w=800",
    "Rice" => "https://images.unsplash.com/photo-1586201327693-86629f8bf827?auto=format&fit=crop&q=80&w=800",
    "Flours & Lentils" => "https://images.unsplash.com/photo-1509440159596-0249088772ff?auto=format&fit=crop&q=80&w=800",
    "Functional Food" => "https://images.unsplash.com/photo-1490645935967-10de6ba17061?auto=format&fit=crop&q=80&w=800",
];

foreach ($images as $name => $url) {
    $cat = Category::where('name', $name)->first();
    if ($cat) {
        echo "Updating image for '{$name}'\n";
        $cat->image = $url;
        $cat->save();
    }
}
