Giter VIP home page Giter VIP logo

Comments (9)

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

Try this route group instead:

<?php

Route::group(['middleware' => 'web'], function () {
    Route::localizedGroup(function() {
        //...
    });
});

If you're using Laravel 5.2 or 5.3, the web middleware is already included in RouteServiceProvider.

First, try to visit www.mysite.com/fr. After that, access the url without the locale www.mysite.com.

For the urls, try to use the route() method with named route.

from localization.

maorkavod avatar maorkavod commented on June 8, 2024

i try that, still the same result, this is my current code :

// app/Http/routes.php

Route::group(['middleware' => 'web'], function () {
    Route::localizedGroup(function() {

        Route::auth();
        Route::get('auth/logout', function(){
            Auth::logout();
            return redirect('/');
        });

        Route::get('', function () {
            if (Auth::check())
            {
                return view('home');
            }else {
                return view('welcome');
            }

        });


        //pages
        Route::get('/home', 'HomeController@index');
        //more Routes like the above.
    });
});

is this ok?

from localization.

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

Is that laravel 5.2 ?

Try this example: #58 (comment)

from localization.

maorkavod avatar maorkavod commented on June 8, 2024

I am using Laravel 5.3

from composer :

"laravel/framework": "5.3.*",

from localization.

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

Why your routes is in app/Http/routes.php ?

from localization.

maorkavod avatar maorkavod commented on June 8, 2024

This is where it was when i download the Laravel framework before a year ago, 5.2
i did the upgrade to 5.3 before 2 months , works great no issues.

you think that this cause the problem?
where this file should be located at?

from localization.

arcanedev-maroc avatar arcanedev-maroc commented on June 8, 2024

This is the new routes file for web: https://github.com/laravel/laravel/blob/master/routes/web.php

Try to follow this upgrade guide: https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0

from localization.

maorkavod avatar maorkavod commented on June 8, 2024

I finish this section upgrade,
my system is still working with all the routes like before.
the problem still exist.

there is a flag in the package to make it work in debug mode?

from localization.

maorkavod avatar maorkavod commented on June 8, 2024
Auth::routes();

Route::group(['middleware' => ['web']], function () {
    Route::group([
        'prefix'     => Localization::setLocale(),
        'middleware' => [
            'localization-session-redirect',
            'localization-redirect',
            'localized-routes',
        ],
    ], function() {

 });

    // Non Localized routes here
});

config :

'accept-language-header' => true,

'hide-default-in-url'    => false,

'facade'                 => 'Localization',

/* ------------------------------------------------------------------------------------------------
 |  Route
 | ------------------------------------------------------------------------------------------------
 */
'route'                  => [
    'middleware' => [
        'localization-session-redirect' => true,
        'localization-cookie-redirect'  => false,
        'localization-redirect'         => true,
        'localized-routes'              => true,
        'translation-redirect'          => true,
    ],
],

from localization.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.