我在提交此表单时遇到问题,它会产生NotFoundHttpException
{{Form::open(array('parsley-validate'=>'','url'=>url('dashboard/send_message')))}}
这是表单应在仪表板文件夹
中的dashHome.php中执行的功能public function postSendMessage()
{
$validator = Validator::make(Input::all(), array(
'studentId' => 'required|exists:student,id',
'content' => 'required',
));
if ($validator->fails())
return Redirect::to('dashboard')->withErrors($validator);
$user = Auth::user();
$user->decrement('sms_credit');
return Redirect::to('dashboard')->with('messageSent',1);
}
这是route.php中的路线
Route::group(array('prefix' => 'dashboard','before'=>'auth'), function() {
Route::get('/', 'dashHome@index');
});
答案 0 :(得分:0)
您需要在dashboard/send_message
文件中为网址routes.php
定义路线,如下所示:
Route::group(array('prefix' => 'dashboard','before'=>'auth'), function()
{
Route::get('/', 'dashHome@index');
Route::post('send_message', 'dashHome@postSendMessage');
});