<?php

namespace App\Http\Controllers;

use App\Models\InvestmentCategory;
use App\Models\Setting;
use Illuminate\Http\Request;

class InvestmentController extends Controller
{
    public function index()
    {
        $categories = InvestmentCategory::where('is_active', true)
            ->orderBy('order')
            ->with(['products' => function($query) {
                $query->where('is_active', true)->orderBy('order');
            }])
            ->get();
        
        $settings = Setting::pluck('value', 'key')->toArray();
        
        return view('investments', compact('categories', 'settings'));
    }
}
