Dol*_*rma 4 php laravel laravel-4
我正在对profile控制器进行分组,我想链接到那个.然后我定义了这条路线:
//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') );
});
Run Code Online (Sandbox Code Playgroud)
这是我的菜单链接:
<li><a href="{{ URL::route('admin.profile') }}">profile Managment</a></li>
Run Code Online (Sandbox Code Playgroud)
这是我route在终端的结果:
+--------+----------------------------------+------------------------+---------------------------+----------------+---------------+
| 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           |               |
+--------+----------------------------------+------------------------+---------------------------+----------------+---------------+
Run Code Online (Sandbox Code Playgroud)
现在我收到这个错误:
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)
Run Code Online (Sandbox Code Playgroud)
    /从Route::resource方法中删除字符.它导致双点,这反过来导致您的错误消息.
应该:
Route::resource('profile' , 'ProfileController', array('as'=>'profile') );
格式(/profile或profile)通常都可以使用,但是当使用该prefix选项时,Route::group您需要删除/源资源URL.
编辑:在我看来,你应该指向你的路线链接admin.profile.index,而不是admin.profile.
|   归档时间:  |  
           
  |  
        
|   查看次数:  |  
           22105 次  |  
        
|   最近记录:  |