<?php

namespace App\Http\Controllers;

use App\Support\ModuloPortal;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;

class PortalController extends Controller
{
    public function __invoke(): View
    {
        $usuario = Auth::user();

        return view('dashboard', [
            'modulos' => collect(ModuloPortal::todos())
                ->filter(fn (array $modulo) => $usuario->can($modulo['permissao']))
                ->values()
                ->all(),
        ]);
    }
}
