Illuminate\Database\QueryException : SQLSTATE[22007]: Invalid datetime format

If you use Mysql5.7 by default you can not set date time to 0000-00-00 00:00:00, you should set to null. If you want to set value like before, you can set sql_mode ref.So how to set it in laravel migration?

Schema::table('posts', function (Blueprint $table) {
$table->dateTime('published_at')->nullable();
});