所以我尝试用 laravel 制作一个表单,但除了新版本之外,他们删除了表单!但我可以让它运行
所以这里是:
Route::post('/register', function()
{
$user = new User;
$user-> u_n = Input::get('u_n');
$user->save();
return View::make('thanks')->with('theEmail',$theEmail);
});
和我的刀片:
{{Form::open(array('url'=>'register'))}}
username : {{Form::label('u_n', 'E-Mail Address');}}
{{Form::text('u_n');}}
{{Form::submit('');}}
u_n 是我的 mysql 数据库字段的名称
这是实际的错误:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into `users` (`u_n`, `updated_at`, `created_at`) values (sepehr, 2014-12-24 14:32:55, 2014-12-24 14:32:55))
发生这种情况是因为 Laravel 假设您想要使用updated_at
and created_at
您的模型的时间戳。因此它也假设它们存在于数据库中。您可以创建两列或通过添加来禁用模型的时间戳
public $timestamps = false;
Laravel 文档 http://laravel.com/docs/4.2/eloquent#timestamps
顺便说一句:如果您正在使用迁移,那么添加时间戳列是一件轻而易举的事。
Schema::table('table_name', function(Blueprint $table){
$table->timestamps();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)