duandanxiu6965 2019-02-28 20:16
浏览 19

Laravel 5.7 - 同一项目中的多个子域和数据库

I am trying to develop an app in Laravel 5.7 that works with 4 subdomains and 2 databases in this way:

Route::domain('www.example.com.br', function($route) { 
    Route::get('/',  function() {
        #single route to the app welcome page
    })->name('welcome');
});

Route::domain('app.example.com.br', function($route) { 
    # connects with database "A"
    ...
    # app routes
    ...
});

Route::domain('dev.example.com.br', function($route) { 
    # connects with database "B"
    ...
    # app routes
    ...
});

Route::domain('sandbox.example.com.br', function($route) { 
    # connects with database "B"
    ...
    # app routes
    ...
});

The "app routes" are the same for the 3 enviroments (app, dev, sandbox).

If a user log in "app.example.com.br" and manually change for "dev.example.com.br", for example, the database changes and must lose the session.

And don't matter which enviroment(app, dev, or sandbox), all app routes must stay in this enviroment, in other words, the app cannot change the initial enviroment acessed by the user.

My problem is exactly this: I access "app.example.com.br" and do the login, the authentication works, but for same reason, I am redirected to "sandbox.example.com.br". I cannot stay in "app.example.com.br".

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度