PHP code example of codewiser / soft-deletes
1. Go to this page and download the library: Download codewiser/soft-deletes 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/ */
codewiser / soft-deletes example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Codewiser\SoftDeletes\PassiveSoftDeletes;
class Flight extends Model
{
use PassiveSoftDeletes;
}
// Will exclude flights with `deleted_at` < now()
Flight::query()->withoutTrashed();
// Will return only flights with `deleted_at` in a next month
Flight::query()->onlyTrashed(now()->addMonth());