vendredi 15 novembre 2019

php artisan default created_at column is NULL instead of current datetime

I create migration like this: php artisan make:migration create_categories_table --create categories

Then I add some columns, like:

Schema::create('categories', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name', 150);
        $table->timestamps();
});

and then: php artisan migrate

This creates table categories, then I insert into categories:

 insert into categories
 (name)
 values
 ('sport')

This inserts row but created_at column is null instead of current timestamp.

What is my mistake?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire