PHP code example of ismayil-dev / epoch-softdelete

1. Go to this page and download the library: Download ismayil-dev/epoch-softdelete library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ismayil-dev / epoch-softdelete example snippets


'providers' => [
    // Other service providers...
    IsmayilDev\EpochSoftDelete\EpochSoftDeleteServiceProvider::class,
],

Schema::table('your_table', function (Blueprint $table) {
    $table->epochSoftDeletes();
});

use IsmayilDev\EpochSoftDelete\EpochSoftDeletes;

class YourModel extends Model
{
    use EpochSoftDeletes;

    // Other model code...
}

YourModel::find(1)->delete();
YourModel::withTrashed()->get();
YourModel::onlyTrashed()->get();
YourModel::find(1)->restore();
// etc.

Schema::table('your_table', function (Blueprint $table) {
    $table->integer('deleted_at')->default(0)->change();
});
bash
php artisan migrate