Laravel-4.1 () timestamp issue

This is my table structure.

public function up() { Schema::create('tags', function($table){ $table->increments('tagId'); $table->string('tagName'); $table->timestamp('tagCreated'); }); } 

When I store the record, it says that the column was not found. Even I do not use "$ table-> timestamps ();"

Please help, how to fix it? Do I need to store "timestamps ()" for each table?

Illuminate \ Database \ QueryException

SQLSTATE [42S22]: column not found: 1054 Unknown column "updated_at" in the "list of fields" (SQL values: insert into the values โ€‹โ€‹of tags ( tagName , tagCreated , updated_at , created_at )) test, 2014-02-08 16:19:04 , 2014-02-08 11:19:09, 2014-02-08 11:19:09))

+7
php laravel laravel-4
source share
1 answer

You need to tell the model that you are not using timestamps by adding

  public $timestamps = false; 

To your class model. You can read more about them here: http://laravel.com/docs/eloquent#timestamps

Note that schema migration is for the database only and not for the model. Laravel does not know that you did not call the "timestamp" during the migration process. You need to indicate the relationship between the model and the schema in your model classes - while migrations just worry about the database directly.

+20
source share

All Articles