我正在尝试创建一个创建功能,如果用户接受条款和条件,它会转到用户可以填充某些内容的页面,但是当我尝试单击按钮查看条款和条件时,它会给我这个错误:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'title' cannot be null (SQL: insert into `reserves` (`title`, `lastname`, `firstname`, `middlename`, `birthday`, `city`, `streetadd`, `zipcode`, `country`, `home`, `work`, `fax`, `mobile`, `email`) values (, , , , , , , , , , , , , ))
我无法通过该页面。我甚至无法进入表格页面,你可以填写东西。怎么会发生这种情况?我应该采取什么步骤来完成这项工作?
以下是我的代码:
路线:
Route::get('/','OnewayflightController@index');
Route::get('flight/onewayflight','OnewayflightController@onewayflight');
Route::post('flight/onewayflight','OnewayflightController@onewayflightresults');
Route::post('flight/onewayflightresults','OnewayflightController@onewayflightterms');
Route::post('flight/onewayflightterms','OnewayflightController@onewayflightfillup');
OnewayflightController.php
public function onewayflightterms()
{
return View::make('content.onewayflightterms');
}
public function onewayflightfillup()
{
$reserve = new Reserves;
$reserve->title = Input::get('title');
$reserve->lastname = Input::get('lastname');
$reserve->firstname= Input::get('firstname');
$reserve->middlename = Input::get('middlename');
$reserve->birthday = Input::get('birthday');
$reserve->city = Input::get('city');
$reserve->streetadd = Input::get('streetadd');
$reserve->zipcode = Input::get('zipcode');
$reserve->country = Input::get('country');
$reserve->home = Input::get('home');
$reserve->work = Input::get('work');
$reserve->fax = Input::get('fax');
$reserve->mobile = Input::get('mobile');
$reserve->email = Input::get('email');
$reserve->save();
}
答案 0 :(得分:1)
这绝对是你的路线问题。
没有导致get
OnewayflightController@onewayflightterms
路线
所以仔细检查你的路线,很可能你得到的错误是因为你的路线导致错误的方法。