Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 11 prefixed routes not picked up. #924

Closed
1 task done
cAstraea opened this issue Dec 2, 2024 · 2 comments
Closed
1 task done

Laravel 11 prefixed routes not picked up. #924

cAstraea opened this issue Dec 2, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@cAstraea
Copy link

cAstraea commented Dec 2, 2024

Scribe version

4.38.0

PHP version

8.3.14

Framework

Laravel

Framework version

11.31.0

Scribe config

title => "*****"
base_url => "https://*****"
type => "laravel"

What happened?

php artisan scribe:generate not picking up Laravel 11 routes defined in bootstrapp/app.php , the routes/api.php is not used anymore.

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        commands: __DIR__ . '/../routes/console.php',
        health: '/up',
        then: function () {
            Route::middleware(['api.user', 'auth:user'])
                ->prefix('user/api')
                ->group(base_path('routes/user/api.php'));

            Route::middleware(['api.admin', 'auth:admin'])
                ->prefix('admin/api')
                ->group(base_path('routes/admin/api.php'));

            Route::prefix('user/api')
                ->group(base_path('routes/anonymous/api.php'));

        }
    )
    ->withMiddleware(function (Middleware $middleware) {

        $middleware->group('api.auth', [SubstituteBindings::class, 'throttle:120,1']);
        $middleware->group('api.user', [SubstituteBindings::class, 'throttle:120,1']);
        $middleware->group('api.admin', [SubstituteBindings::class, 'throttle:120,1']);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();

Docs

@cAstraea cAstraea added bug Something isn't working triage labels Dec 2, 2024
@shalvah
Copy link
Contributor

shalvah commented Jan 19, 2025

Ah, I'll look into that!

@shalvah
Copy link
Contributor

shalvah commented Feb 3, 2025

I think this is a user error! What is your config (routes -> match -> 0 -> prefixes) set to? It looks like you're using the default, which is api/*), so it won't match user/api.

@shalvah shalvah closed this as completed Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants