<?php

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        using: function (\Illuminate\Routing\Router $router) {

            $router->middleware('api')
                ->prefix('api')
                ->group(base_path('routes/api.php'));

            $router->middleware('web')
                ->group(base_path('routes/web.php'));

            $router->middleware('web')
                ->prefix('admin')
                ->group(base_path('routes/admin.php'));

               $router->middleware('web')
                ->prefix('user')
                ->group(base_path('routes/user.php'));

            $router->middleware('web')
                ->prefix('crm')
                ->group(base_path('routes/crm.php'));
        }
    )
    ->withMiddleware(function (Middleware $middleware): void {
        //
    })
    ->withExceptions(function (Exceptions $exceptions): void {
        //
    })->create();
