【发布时间】:2014-04-10 05:26:19
【问题描述】:
在我的表单中,我有简单的更新表单,我可以从模型中填写输入标签。但是在点击提交按钮发送输入值后,我得到了这个错误:
Controller method not found.
我的表格:
{{Form::model( array('route'=>array('admin.profile.update',$profile->id), 'method'=>'post')) }}
我的路线:
Route::group(array('prefix'=> 'admin' ,'before'=>'auth'), function(){
Route::controller('profile', 'profileController', array('getIndex'=>'profile.index', 'postUpdate'=>'profile.update'));
});
我的控制器:
class ProfileController extends \BaseController {
protected $layout = 'layouts.admin.main';
function __construct() {
$this->beforeFilter('auth', array('except' => array('getIndex', 'postUpdate')));
$this->beforeFilter('csrf', array('on' => 'post'));
}
public function getIndex()
{
}
public function postUpdate($id)
{
}
}
html 的结果:
<form accept-charset="UTF-8" action="http://localhost/alachiq/admin/profile/index" method="POST"><input type="hidden" value="fDhe6m2qHh7NOERQaGvwDPJwCkbGTIRr56IBHseI" name="_token">
表单的动作是:
http://localhost/alachiq/admin/profile/index
那一定是:
http://localhost/alachiq/admin/profile/update
工匠路线:
GET admin/profile/index/{one?}/{two?}/{three?}/{four?}/{five?} | profile.index | profileController@getIndex
GET admin/profile | | profileController@getIndex
POST admin/profile/update/{one?}/{two?}/{three?}/{four?}/{five?} | profile.update | profileController@postUpdate
【问题讨论】: