<?php

namespace App\Http\Controllers\Admin;

use App\Models\Business;
use Illuminate\Http\Request;
use Inertia\Inertia;

class AdminBusinessController extends Controller
{
    public function index()
    {
        $businesses = Business::latest()->get();

        return Inertia::render('Admin/Businesses/Index', [
            'businesses' => $businesses,
        ]);
    }

    public function show(Business $business)
    {
        return Inertia::render('Admin/Businesses/Show', [
            'business' => $business->load(['products', 'sales', 'repairs', 'secondHands', 'unlockOrders', 'payments']),
        ]);
    }
}