所以我试图用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
和created_at
时间戳。因此,还假定它们存在于数据库中。您可以通过添加以下内容来创建两列或为模型禁用时间戳
public $timestamps = false;
顺便说一句:如果您正在使用迁移,添加时间戳列很容易。
Schema::table('table_name', function(Blueprint $table){
$table->timestamps();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句