PHP code example of mvdnbrk / laravel-model-expires
1. Go to this page and download the library: Download mvdnbrk/laravel-model-expires 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/ */
mvdnbrk / laravel-model-expires example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Mvdnbrk\EloquentExpirable\Expirable;
class Subscription extends Model
{
use Expirable;
}
class CreateSubscriptionsTable extends Migration
{
public function up(): void
{
Schema::create('subscriptions', function (Blueprint $table) {
$table->expires();
});
}
public function down(): void
{
Schema::dropExpires();
}
}
class Subscription extends Model
{
use Expirable;
const EXPIRES_AT = 'ends_at';
}