$ php artisan make:migration add_soft_deletes_to_user_table --table="users"}
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;
Schema::table('flights', function (Blueprint $table) {
$table->softDeletes();
});
Schema::table('flights', function (Blueprint $table) {
$table->dropSoftDeletes();
});
use IlluminateDatabaseEloquentSoftDeletes;class User extends Model {use SoftDeletes; protected $dates = ['deleted_at'];}
// delete a migration safely from laravel
delete migration from database/migrations/ directory
and also delete entry from migrations table
Comment::where('post_id',$id)->delete();
// in down migration
public function down()
{
Schema::table('package_types', function (Blueprint $table) {
AppModelsPackageType::query()->where('id','gt',1)->delete();
});
}
>>> $test->forceDelete();
=> true