• 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

What is PHP's equivalent of JavaScript's "array.every()"?

how to sort by a custom appended relation to model

Show date difference as "20" instead of "20 years ago"

Stop caching for PHP 5.5.3 in MAMP

How to Install Composer Require doctrine/dbal

500 (Internal Server Error) with Laravel & Docker [duplicate]

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

calling server using nusoap with complextype

Query Optimization, changing the queries in the loop into a single processing query

How do I call Validator from a namespace with an already existing Validator class

"cannot list resources" error from WooCommerce REST API

Transpose csv file data [duplicate]

How to fix bootstrap multiselect search data using ajax

Use same method for inertia response and json response Laravel Jetstream

Unable to Edit config.inc.php

About Contact Privacy policy Terms and conditions