Laravel Scribe issues (model route binding in FormRequests and generation error)

210 Views Asked by At

I faced with route model binding error while generating documentation:

enter image description here

This issue appears in few routes (not in all, only where im calling model from route for data validation). Iwe tried to bind models manually with normalizeEndpointUrlUsing() like so

            Scribe::normalizeEndpointUrlUsing(
                function (string           $url, Route $route, ReflectionFunctionAbstract $method,
                          ?ReflectionClass $controller, callable $default
                ) {

                    return match ($url) {

                        'api/v1/admins/advertisers/{advertiser}' => 'api/v1/admins/advertisers/' . Advertiser::first()->id,

                        default => $default(),
                    };
                });

Also tried to set in the same way in instantiateFormRequestUsing() like auth()->user() instance

No effect.

In the end of php artisan scribe:generate command also have Undefined array key "PATH" error enter image description here

Also, i have issue with auth routes, im using Sanctum SPA auth and tried to set scrf cookie, but no effect, them throws an unauthorized error in doc. I starte to use Bearer token in Authorization header, but maybe there is a way to set csrf-cookie.

Config has no any non-standard issues.

Thanks in advance.

0

There are 0 best solutions below