Long story short. I created a migration named "create_music_table" which have following field increments('id'),string('title',70),string('url',255) and whenever i tried to insert a new record using ORM
$music = new Music; $music->title = "Monster"; $music->url = "aksjdaskldjsakldas"; $music->singer = "Emenim ft Rihannah"; $music->save();
its hitting this message
Illuminate \ Database \ QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'updated_at' in 'field list' (SQL: insert into `music` (`title`, `url`, `singer`, `updated_at`, `created_at`) values (Monster, aksjdaskldjsakldas, Emenim ft Rihannah, 2014-03-30 17:28:35, 2014-03-30 17:28:35))
are you kiddding me?
well, you should have a look here: http://laravel.com/docs/eloquent#timestamps and here http://laravel.com/docs/schema
long storry short. -> In your model (Music), add the following somewhere near the top
public $timestamps = false;
OR in your migration, add
and rerun the migration
So did you read the docs? http://laravel.com/docs/eloquent
Once a model is defined, you are ready to start retrieving and creating records in your table. Note that you will need to place updated_at and created_at columns on your table by default. If you do not wish to have these columns automatically maintained, set the $timestamps property on your model to false.
If you want timestamp, just add
$table->timestamps(); to your migration.
Sign in to participate in this thread!