You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of manually having to add the middlewares globally, then we could add a config (default disabled) to automatically push these middlewares to the global stack.
protectedfunctionregisterMiddleware(): void
{
// The interface does not have the methods hasMiddleware() and prependMiddleware() but the actual implementation does$kernel = $this->app[\Illuminate\Contracts\Http\Kernel::class];
if (method_exists($kernel, 'hasMiddleware') && $kernel->hasMiddleware(ClockworkMiddleware::class): {
return;
}
if (! method_exists($kernel, 'prependMiddleware')) {
return;
}
$kernel->prependMiddleware(ClockworkMiddleware::class);
}
Instead of manually having to add the middlewares globally, then we could add a config (default
disabled
) to automatically push these middlewares to the global stack.This is done in itsgoingd/clockwork
And also in Laravel Jetstream even without the checks.
Question: Is there no better way? It seems incorrect to "assume" (or check for existence) of methods not defined on the interface.
The text was updated successfully, but these errors were encountered: