Jetstream & Custom auth guard. Implement withoutMiddleware #4692
-
Description:If the application has JetStream installed and configured a custom auth guard with a provider eloquent (example:
Which seems that in Nova the middleware Detailed steps to reproduce the issue on a fresh Nova installation:
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
Please provide the full reproducing repository similar to https://github.com/nova-issues in order for us to debug the issue. |
Beta Was this translation helpful? Give feedback.
-
@crynobone thanks for your reply.
I hope this clarifies better the issue. Thank you. |
Beta Was this translation helpful? Give feedback.
-
This is not a Nova bug and you're using Jetstream incorrectly. Submit a request to Jetstream to support using multiple User model where one doesn't use Team feature when configured with Team feature. |
Beta Was this translation helpful? Give feedback.
-
@crynobone thanks again for your response. Indeed it's not a bug of Nova but it seems Jetstream doesn't play well if I have a custom model for other purposes (in this case for Nova). Closing this and hopefully will find a solution. |
Beta Was this translation helpful? Give feedback.
-
@crynobone I've been thinking that Nova could handle this situation easily. We just need a custom config to specify which middlewares we want to be removed from Nova routes. See below example: vendor/laravel/nova/src/PendingRouteRegistration.php Route::namespace('Laravel\Nova\Http\Controllers')
->domain(config('nova.domain', null))
->middleware(config('nova.middleware', []))
->withoutMiddleware(config('nova.withoutMiddleware', [])) <-- new addition config/nova.php 'withoutMiddleware' => [
\Laravel\Jetstream\Http\Middleware\ShareInertiaData::class,
], Same for This can help unload specific middlewares that are injected by other packages installed in Laravel. I think it would be a great solution not only for this specific case but for others too. What do you think? Thanks. |
Beta Was this translation helpful? Give feedback.
-
I saw that @crynobone had his PR for Jetstream merged, which will check if the Model actually has Teams implemented (HasTeams trait or actual method names), before using it. Jetstream containing that PR was released about an hour ago. 🙂 |
Beta Was this translation helpful? Give feedback.
I saw that @crynobone had his PR for Jetstream merged, which will check if the Model actually has Teams implemented (HasTeams trait or actual method names), before using it.
I immediately came to think of this discussion and believe that should fix this issue.
Jetstream containing that PR was released about an hour ago. 🙂