<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\MainCarusel; // Make sure this matches your model
use Illuminate\Support\Facades\DB;
use App\Models\Destination;

class MainCaruselController extends Controller
{

public function getCarouselData()
{
    $carouselItems = MainCarusel::all()->map(function ($item) {
        $item->image = url('images/carousel/' . basename($item->image));
        return $item;
    });

    return response()->json($carouselItems);
}

public function packages()
{
    return response()->json(
        Destination::orderBy('id', 'desc')->take(6)->get()->reverse()->values()
    );
}



public function packagesall()
{
    return response()->json(Destination::all());
}


}
