Php 使用控制器路由的Laravel

Php 使用控制器路由的Laravel,php,laravel,laravel-4,Php,Laravel,Laravel 4,我在路由中有资源,并且可以正常工作,我想将其更改为route::controller 但是在定义之后,我在php artisan路由中得到错误: +--------+------------------------------------+-----------+---------------------------------+----------------+---------------+ | Domain | URI

我在路由中有资源,并且可以正常工作,我想将其更改为
route::controller

但是在定义之后,我在
php artisan路由中得到错误:

   +--------+------------------------------------+-----------+---------------------------------+----------------+---------------+
    | Domain | URI                                | Name      | Action                          | Before Filters | After Filters |
    +--------+------------------------------------+-----------+---------------------------------+----------------+---------------+
    |        | GET index                          | index     | Closure                         |                |               |
    |        | GET admin/index                    | dashboard | Closure                         |                |               |
    |        | GET logout                         | logout    | Closure                         |                |               |
    |        | POST auth                          | auth      | Closure                         | csrf           |               |
    |        | GET login                          | login     | Closure                         |                |               |
    |        | GET admin/admin/profile/{_missing} |           | ProfileController@missingMethod |                |               |
    +--------+------------------------------------+-----------+---------------------------------+----------------+---------------+
我目前的路线是:

Route::resource('profile' , 'ProfileController', array('as'=>'profile') );
我想把它改成:

Route::controller('admin/profile', 'ProfileController', array('index'=>'profile.index') );
如何解决此问题?

使用:

Route::resource('profile, 'ProfileController', array('as' => 'profile', 'names' => array('index' => 'profile.index')));

这不是一个错误,资源和控制器路由是完全不同的

资源路由具有预定义的路由列表(索引、创建、存储、删除、更新)。如果您的控制器中没有设置该方法,它仍然可以工作,除非有人点击该路径

控制器路由依赖于控制器方法:

public function getIndex() {}
public function getCreate() {}
public function postStore() {}
方法名称预定义为

<http method><your action name>()
在你的控制器中运行

php artisan route

再来一次。

谢谢。我现在得到这个结果。
get admin/admin/profile/index/{one?}/{two?}/{two?}/{two?}/{four?}/{five?}
如何将
设置为
?我的链接是
/admin/profile
如何解决这个问题?这些路线是否在
路线::组中
?我有一条进入
组的路线
我确实读了你的问题,我同意他们在帖子中给出的答案。使用::controller是一种不好的做法,应该避免。出于这个原因,我推荐上面这一行代码来满足您的需求。您的报价是
resource
:)
php artisan route