我有下面的路由组,里面有一个资源。
Route::group(array( 'prefix' => 'admin' , 'before' => 'admin-auth' ), function() {
Route::group(array( 'prefix' => 'hosts'), function() {
Route::resource('/', 'HostsController' );
});
});
正如我在php artisan routes
| GET /admin/hosts | admin.hosts...index | HostsController@index | admin-auth
| GET /admin/hosts/create | admin.hosts...create | HostsController@create | admin-auth
| POST /admin/hosts | admin.hosts...store | HostsController@store | admin-auth
| GET /admin/hosts/{} | admin.hosts...show | HostsController@show | admin-auth
| GET /admin/hosts/{}/edit | admin.hosts...edit | HostsController@edit | admin-auth
| PUT /admin/hosts/{} | admin.hosts...update | HostsController@update | admin-auth
| PATCH /admin/hosts/{} | | HostsController@update | admin-auth
| DELETE /admin/hosts/{} | admin.hosts...destroy | HostsController@destroy | admin-auth
如何调用路由的链接?我试过类似的东西
{{route('admin.hosts...show', array($host->id) )}}
但我得到一个array_combine()
错误。
编辑
我已经改成这个了。
Route::group(array( 'prefix' => 'admin' , 'before' => 'admin-auth' ), function() {
Route::resource('/hosts', 'HostsController' );
但我仍然得到一个双点路线名称。
GET /admin/hosts | admin..hosts.index | HostsController@index
GET /admin/hosts/create | admin..hosts.create | HostsController@create
POST /admin/hosts | admin..hosts.store | HostsController@store
GET /admin/hosts/{hosts} | admin..hosts.show | HostsController@show
GET /admin/hosts/{hosts}/edit | admin..hosts.edit | HostsController@edit
PUT /admin/hosts/{hosts} | admin..hosts.update | HostsController@update
PATCH /admin/hosts/{hosts} | | HostsController@update
DELETE /admin/hosts/{hosts} | admin..hosts.destroy | HostsController@destroy
现在我可以让它工作,但这不是很奇怪吗?