dongxi3209 2017-08-18 12:50
浏览 40
已采纳

如何将新路线映射到Laravel的特定旧路线?

I have following route group for admin panel

Route::prefix('admin')->group(function (){
.
.
.}

I want to wrap this route to a new route e.g asda12asda

so that old behavior :

/admin/users

is changed to :

/asda12asda/users

not allowing old route. I don't want to change it internally from the system and want to find some efficient Laravel way to achieve it.

  • 写回答

2条回答 默认 最新

  • drr7731 2017-08-18 13:13
    关注

    Redirect the old route to a new route

    Route::prefix('admin')->group(function (){    
        Route::any('login', function () {
            // Redirect to new route
            redirect()->route('new route');
        });
    });
    

    by creating a new route and mapping it accordingly

    Route::prefix('asda12asda')->group(function () {
        Route::any('login', function () {
            // Do whatever you were about to do
        })->name('new route');
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥40 图书信息管理系统程序编写
  • ¥15 7-1 jmu-java-m02-使用二维数组存储多元线性方程组
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题