<?php

namespace App\Http\Controllers;

use App\Models\Service;
use Illuminate\Http\Request;

class ServiceController extends Controller
{
    public function index()
    {
        $services = Service::where('is_active', true)
            ->orderBy('order')
            ->get()
            ->map(function ($service) {
                // Pastikan features selalu array (tapi sebenarnya sudah dihandle Model)
                if (!is_array($service->features)) {
                    $service->features = [];
                }
                return $service;
            });

        return view('services', compact('services'));
    }
}