我在使用 Laravel 4 嵌套路由时遇到问题。我可以显示创建方法表单但无法存储。这是代码,我将直截了当。我有一个基本资源控制器和另一个嵌套控制器
This is in my Routes.php
Route::resource('profile','ProfileController');
Route::resource('profile.bands','BandsController');
我认为我不必在此处显示配置文件的代码,我将向您展示 BandsController
public function create($profileId)
{
return View::make('bands.create',['title' => 'Create Band Profile' , 'profileId' => $profileId]);
}
如您所知,这只会显示表单。表格是:
{{Form::open( [ 'route' => ['profile.bands.create',$profileId]])}}
<input class="input" type="text" name="name" value="" />
<input class="input" type="text" name="city" value="" />
<input type="submit" value="submit" />
{{Form::close()}}
现在,我不明白,当我在浏览器中查看表单操作 url 时看起来不错,但是当我提交它时,我得到了这个错误。
Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException
open: E:\server\www\gigmor.com\gigmor\vendor\laravel\framework\src\Illuminate\Routing\Router.php
// The method not allowed exception is essentially a HTTP 405 error, so we
// will grab the allowed methods when converting into the HTTP Kernel's
// version of the exact error. This gives us a good RESTful API site.
elseif ($e instanceof MethodNotAllowedException)
{
$allowed = $e->getAllowedMethods();
throw new MethodNotAllowedHttpException($allowed, $e->getMessage());
}
}
我可能做错了什么?