• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Laravel set default language not working

phplaravellocalization


PHP Snippet 1:

'useAcceptLanguageHeader' => false,

PHP Snippet 2:

'hideDefaultLocaleInURL' => true,

PHP Snippet 3:

public function __construct(){}

PHP Snippet 4:

Route::get('/', function () {
    if (Session::get('language') == 'en') {
        Session::put('language', 'en');
        App::setLocale('en');
        return redirect('main-services/1/1');
    } else {
        Session::put('language', 'ar');
        App::setLocale('ar');
        return redirect('main-services/1/1');
    }
});

Related Snippets

Reading input in php from terminal

Elastic Beanstalk with Laravel Envoy

How to modify CSS in a specific page of the WP admin dashboard (backend)

Handling expired token in Laravel

XAMPP keeps showing Dashboard/Welcome Page instead of the Configuration Page

str_replace or preg_replace random number from string

getting error while enter Command => php artisan route:list

Fetch files from next cloud storage and display in Laravel website

How To Access A Column In M-M Relationship Table In Laravel

Select option menu read from database and use it's values

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

Valet, Xdebug after reboot Big Sur not working

PHP Form Not Inserting

Edit XML in HTML form and submit to self

How do I truncate a decimal in PHP?

About Contact Privacy policy Terms and conditions