Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel default websie ar

//To make the default website with the language AR.
//At first time, the user does not have any session. So, we will add a
//session and set the language to be AR if it is not the first time. 
//Then, depending on the language you choose.

//web.php
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');
    }
});
 
PREVIOUS NEXT
Tagged: #laravel #default #websie #ar
ADD COMMENT
Topic
Name
4+9 =