ewing1990
ewing1990

Reputation: 47

Get locale to controller variable

I have AuthController here, where you can see it has some variables in it. I'm using them as paths after operation.

class AuthController extends Controller {
    use AuthenticatesAndRegistersUsers;
    private $loginPath = "authenticate";
    protected $redirectPath = "/";
}

The problem is I'm using Laravel localization, after login, registration operations, it returns to sites default locale. For example if I was in www.mysite.com/de/authenticate, after login operation I'm in www.mysite.com/en. I tried to put a method in it, like $loginPath = App::getLocale()."/authenticate"; but it won't work.

Upvotes: 1

Views: 640

Answers (1)

Limon Monte
Limon Monte

Reputation: 54379

With the standard configuration this should work:

$locale = config('app.locale');

Upvotes: 3

Related Questions