-
add
"repositories": [ { "type": "vcs", "url": "[email protected]:wilzokch/laravel-custom-soft-delete.git" } ],
to your composer.json.
-
run the
composer require
command from your terminal:composer require wilzokch/laravel-custom-soft-delete:dev-master
-
add the Wilzokch\LaravelCustomSoftDelete\SoftDeletes trait to the model:
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Wilzokch\LaravelCustomSoftDelete\SoftDeletes; class Flight extends Model { use SoftDeletes; }
-
add soft delete columns to your migration
use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; Schema::table('flights', function (Blueprint $table) { $table->tinyInteger('is_deleted')->default(false)->index(); $table->timestamp('deleted_at')->nullable(); }); Schema::table('flights', function (Blueprint $table) { $table->dropColumn('is_deleted'); $table->dropColumn('deleted_at'); });
-
Notifications
You must be signed in to change notification settings - Fork 0
wilzokch/laravel-custom-soft-delete
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Laravel package that use is_deleted flag for soft delete & retain deleted_at to keep track date of deletion
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published