Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
79 views
in Technique[技术] by (71.8m points)

production.ERROR: Class AppHttpMiddlewareSetLocale does not exist in Laravel

My Laravel-5.8 application was working, but suddenly I got this error:

production.ERROR: Class AppHttpMiddlewareSetLocale does not exist

and can't login again.

The SetLocale exists. This is it:

namespace AppHttpMiddleware;

use Closure;

class SetLocale
{
    public function handle($request, Closure $next)
    {
        if (request('change_language')) {
            session()->put('language', request('change_language'));
            $language = request('change_language');
        } elseif (session('language')) {
            $language = session('language');
        } elseif (config('panel.primary_language')) {
            $language = config('panel.primary_language');
        }

        if (isset($language)) {
            app()->setLocale($language);
        }

        return $next($request);
    }
}

How do I resolve it?

Thanks

question from:https://stackoverflow.com/questions/65647696/production-error-class-app-http-middleware-setlocale-does-not-exist-in-laravel

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Namespace seems correct and only thing I can think of is composer cache.

Try to run command composer dumpautoload at your project root directory to force the autoload file to regenerate.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...