Hasan Setiawan

Write, write, write give your wings on code!

Follow me on GitHub

Laravel access violation 'created_at'

I recently setup a new php7 server. When I came to deploy my code it fails during the migrations.

All of the migrations fail to run due to the default value for timestamps. They're set to 0000-00-00 00:00:00 which apparently MySQL doesn't like (assuming due to strict mode).

Solution:

      
        //config/database.php
        ...
        'mysql' => [
            'driver'    => 'mysql',
            ...
            'strict'    => true,  // change false  to true
        ],
        ...