PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 18, 2022

[FIXED] Laravel : App::setLocale doesn't work

 January 18, 2022     laravel, laravel-5.1, localization, php     No comments   

Issue

I'm using laravel 5.1, I'm trying to update locale in app file like this : In Locale Middleware file :

...
public function handle($request, Closure $next)
    {       
        if(Session::has('locale'))
        {
            $lang = Session::get('locale');            
            App::setLocale($lang);        
        }

        return $next($request);
    }

Any idea about this ??


Solution

Oooof finally after two hours ><' !! It's the line place of locale class in middleware -.-' !!! I set it in last line like this :

    ...
    ...
    \App\Http\Middleware\VerifyCsrfToken::class,
        \App\Http\Middleware\Locale::class,        
    ];

and All is fine and working ! thanks for you all :))))



Answered By - BKF
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing