dongshi2836 2015-04-22 23:15
浏览 48
已采纳

从子域链接到根域Laravel 4.2

I have 1 subdomain in my app: admin.test.com and then the root is test.com. While in admin.test.com I want to send an email to a user to log in to test.com/login/aseqgaasd but right now it is sending the link to admin.test.com/login/aseqgaasd.

How can I use the {{ URL::to('login', array($code)) }} method to route to the main domain and not the sub domain?

I do not want to use .htaccess

  • 写回答

1条回答 默认 最新

  • dtlh12053 2015-04-23 03:57
    关注

    You could use named routes. For example, in your routes.php:

    Route::get('login/{param}', array('as' => 'TestLogin', 'uses' => 'HomeController@login'));
    

    Then, in your Blade template:

    {{ URL::route('TestLogin', array('param' => $code)) }}
    

    I don't know what your routes file looks like, so you would need to adjust this to fit your needs. The important piece is the 'as' => 'TestLogin' since that's what names the route and allows it to be referred to as such throughout your application.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用三极管设计—个共射极放大电路
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示