PHP code example of lidongyooo / laravel-idempotent

1. Go to this page and download the library: Download lidongyooo/laravel-idempotent 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/ */

    

lidongyooo / laravel-idempotent example snippets


'providers' => [
    // ...
    Lidongyooo\Idempotent\IdempotentServiceProvider::class,
],

// ...
Route::post('/test', function () {
    return 'test';
})->middleware('idempotent');

//如果你想强制缓存响应
Route::post('/test', function () {
    return 'test';
})->middleware('idempotent:true');

protected $middlewareGroups = [
    // ...
    'api' => [
        'idempotent',
        'throttle:api',
        \Illuminate\Routing\Middleware\SubstituteBindings::class,
    ],
];

abort(425, 'Your request is still being processed.');

$response->header($this->config['back_header_name'], $idempotentKey);

$ php artisan vendor:publish --tag="laravel-idempotent"