<?php

namespace App\Http\Controllers;

use App\Models\Customer;
use App\Models\ServiceFile;

class ManagementController extends Controller
{
    protected string $defaultTab = 'customers';

    public function index(?string $tab = null)
    {
        if (! $tab) {
            return redirect()->route('management.index', ['tab' => $this->defaultTab]);
        }

        return view('management.index', [
            'customers'    => Customer::all(),
            'serviceFiles' => ServiceFile::paginate(15),
            'tab'          => $tab,
        ]);
    }
}
