1. Go to this page and download the library: Download andresuntoro/softexpires 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/ */
andresuntoro / softexpires example snippets
namespace App\Models;
use AndreSuntoro\Database\Eloquent\SoftExpires;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Transaction extends Model {
use SoftDeletes, SoftExpires;
// ..
}
namespace App\Models;
use AndreSuntoro\Database\Eloquent\SoftExpires;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Transaction extends Model {
use SoftDeletes, SoftExpires;
// in seconds, example 600 seconds (10 mins). The default is 300 seconds if not specified.
const EXPIRED_AT_VALUE = 600;
}
namespace App\Models;
use AndreSuntoro\Database\Eloquent\SoftExpires;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Transaction extends Model {
use SoftDeletes, SoftExpires;
const EXPIRED_AT = 'my_expired_at';
}
use App\Models\Transaction;
// As noted above, soft expired models will automatically be excluded from query results. However, you may force soft expired models to be soft expired model, you may call the reset method on a model instance. The restore method will set the model's expired_at column to null or your specified datetime:
$trx = Transaction::find(1);
$trx->reset(); // Set to null
$trx->reset(date('Y-m-d H:i:s')); // Set to your desired date time value
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.