doulian1852 2014-08-06 10:42
浏览 323
已采纳

在Laravel中没有前缀URI的前缀路由名称

I have two namespaces 'Front' and 'Admin'. For 'Admin' namespace it is OK to have all paths prefixed with admin.conrtoller.action, but for 'Front' I want to have prefixed route names without prefixed URIs.

Route::group(array('namespace' => 'Front'), function()
{
    Route::resource('franchising', 'FranchisingController', array('only' => array('index')));
});

This generates me franchising.index root name and get 'franchising' URI. How to make all resources in this group to generate route names like front.franchising.index, but leave current URIs without change (i.e. not prefixing it with front/).

I use Laravel 4.2.

  • 写回答

3条回答 默认 最新

  • douba8758 2014-08-06 10:56
    关注

    Route prefix is mainly for prefixing the path. The fact that it also prefixes route names, is just an added behavior when using Route::resource().

    EDIT

    It is definitely not possible with the actual prefixing, using a prefix route group parameter, in Laravel out of the box.

    Route::resource() and Route::controller() are only a shortcuts for small amount of real use cases, where they fit. They are definitely not tools that fits for everything. If more control over routes is needed, manually specifying routes with Route::get, Route::post and such is advisable.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 CATIA有些零件打开直接单机确定终止
  • ¥15 请问有会的吗,用MATLAB做
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 ARIMA模型时间序列预测用pathon解决
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序,怎么查看客户esp32板子上程序及烧录地址