laravel控制器REST风格,形式
问题描述:
我要发布一个注册表格与REST类型的语法“认证/申遗”,但它不工作,它给了我这个错误laravel控制器REST风格,形式
InvalidArgumentException
Route [auth/inscription] not defined.
路线:
Route::controller('auth', 'AuthController');
控制器:
public function postInscription()
{
if ($this->create_validation->fails()) {
return Redirect::route('auth/inscription')
->withInput()
->withErrors($this->create_validation->errors());
}
else
{
$this->user_gestion->store();
return Redirect::route('home')
->with('ok','L\'utilisateur a bien été créé.');
}
}
inscription.blade.php: (我们只需要线)
{{ Form::open(array('url' => 'auth/inscription', 'method' => 'post', 'class' => 'form-horizontal panel')) }}
因此,错误:
InvalidArgumentException
Route [auth/inscription] not defined.
不明白... 有人可以帮助我吗?
答
这是因为'auth/subscription'不是命名路由。
您可以在控制器路由的第三个参数中传递一个名称/方法数组。
OR
就行更改为:
return Redirect::to('auth/inscription');
答
错误可能在您的退货声明失败的题词后。你有没有定义getInscription-Method你可以重定向你的用户?
return Redirect::route('auth/inscription')
肯定的,那就是:公共职能getInscription(){返回查看::让( '申遗'); } – edofthadead 2014-09-12 15:05:20