1. Go to this page and download the library: Download laragear/expire-route 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/ */
laragear / expire-route example snippets
use Illuminate\Support\Facades\Route;
use App\Models\Payment;
use App\Models\Party;
Route::get('/payment/{payment}', function (Payment $payment) {
// ...
})->middleware('expires');
use Illuminate\Support\Facades\Route;
use App\Models\Payment;
Route::get('payment/{payment}', function (Payment $payment) {
// ...
})->middleware('expires');
use Illuminate\Support\Facades\Route;
use App\Models\Payment;
use App\Models\Detail;
Route::get('payment/{payment}/detail/{detail}', function (Payment $payment, Detail $detail) {
// ...
})->middleware('expires:payment');
use Illuminate\Support\Facades\Route;
use App\Models\Payment;
use App\Models\Detail;
Route::get('payment/{payment}/detail/{detail}', function (Payment $payment, Detail $detail) {
// ...
})->middleware('expires:payment.dates.due_at');
use Illuminate\Support\Facades\Route;
use App\Models\Payment;
use App\Models\Detail;
use App\Models\Party;
Route::get('party/{party}', function (Party $party) {
// ...
})->middleware('expires:party,60');
Route::get('payment/{payment}/detail/{detail}', function (Payment $payment, Detail $detail) {
// ...
})->middleware('expires:payment.created_at,24 hours');
use Illuminate\Support\Facades\Route;
class Thing
{
public function __construct(public $expiredAt = 'yesterday')
{
// ...
}
}
Route::bind('thing', fn($value) => new Thing($value));
Route::get('some/{thing}', function (Thing $thing) {
// ...
})->middleware('expires:thing.expiredAt');
use Illuminate\Support\Facades\Route;
use Laragear\ExpireRoute\Http\Middleware\Expires;
Route::get('/payment/{payment}')->middleware(Expires::by('payment')->in(1)->hour()->and(30)->minutes());
Route::get('/payment/{payment}')->middleware(Expires::by('payment')->after('next monday');
Route::get('/payment/{payment}')->middleware(Expires::by('payment.expiration_time'));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.