• 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

Performance of foreach, array_map with lambda and array_map with static function

Normalize DateInterval in PHP

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

PHP's array_map including keys

Generate random username based on full name php

Sliders in Laravel

MySQL - Connection failed: No route to host

Laravel 5.5 change unauthenticated login redirect url

Laravel implode array items to new lines

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

jQuery Ajax Post with data

I cannot create a auto generated date time in mysql workbench

Laravel after login Two factor not working

Laravel 8 factory state afterCreating

Detect if PHP session exists

About Contact Privacy policy Terms and conditions