How to create laravel softDeletes migration

Here we will discuss how to create soft delete migration.

Laravel softDeletes migration

Laravel migration softDeletes() method create a deleted_at name column which is TIMESTAMP type column. You can also modified this column name by passing in first argument. This column store a date time when data soft delete.

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->softDeletes(); // create delete_at column
        $table->softDeletes('custom_name'); // create custom_name timestamp column
    });
}
php laravel developer anmol sharma

Anmol Sharma

I am a software engineer and have experience in web development technologies like php, Laravel, Codeigniter, javascript, jquery, bootstrap and I like to share my deep knowledge by these blogs.

Random tutorial links