php – Laravel链接到未定义的路由
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了php – Laravel链接到未定义的路由,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3224字,纯文字阅读大概需要5分钟。
内容图文
我正在对配置文件控制器进行分组,我想链接到它.然后我定义了这条路线:
//Group to put all the routes that need login first
Route::group(array('prefix'=> 'admin', 'before' => 'csrf'), function(){
Route::resource('/profile' , 'ProfileController', array('as'=>'profile') );
});
这是我的菜单链接:
<li><a href="{{ URL::route('admin.profile') }}">profile Managment</a></li>
这是我在终端路由的结果:
+--------+----------------------------------+------------------------+---------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------+----------------------------------+------------------------+---------------------------+----------------+---------------+
| | GET / | index | Closure | | |
| | GET admin/index | dashboard | Closure | | |
| | GET logout | logout | Closure | | |
| | POST auth | auth | Closure | csrf | |
| | GET login | login | Closure | | |
| | GET admin/profile | admin..profile.index | ProfileController@index | csrf | |
| | GET admin/profile/create | admin..profile.create | ProfileController@create | csrf | |
| | POST admin/profile | admin..profile.store | ProfileController@store | csrf | |
| | GET admin/profile/{profile} | admin..profile.show | ProfileController@show | csrf | |
| | GET admin/profile/{profile}/edit | admin..profile.edit | ProfileController@edit | csrf | |
| | PUT admin/profile/{profile} | admin..profile.update | ProfileController@update | csrf | |
| | PATCH admin/profile/{profile} | | ProfileController@update | csrf | |
| | DELETE admin/profile/{profile} | admin..profile.destroy | ProfileController@destroy | csrf | |
+--------+----------------------------------+------------------------+---------------------------+----------------+---------------+
现在我收到这个错误:
ErrorException
Route [admin.profile] not defined. (View: /var/www/alachiq/app/views/back_end/menu.blade.php) (View: /var/www/alachiq/app/views/back_end/menu.blade.php) (View: /var/www/alachiq/app/views/back_end/menu.blade.php)
解决方法:
从Route :: resource方法中删除/字符.它导致双点,这反过来导致您的错误消息.
应该:
Route :: resource(‘profile’,’ProfileController’,array(‘as’=>’profile’));
格式(/配置文件或配置文件)通常都可以使用,但是当使用带有Route :: group的前缀选项时,您需要删除/ from资源URL.
编辑:在我看来,你应该指向您的链接路由admin.profile.index,而不是admin.profile.
内容总结
以上是互联网集市为您收集整理的php – Laravel链接到未定义的路由全部内容,希望文章能够帮你解决php – Laravel链接到未定义的路由所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。