Skip to content

Instantly share code, notes, and snippets.

View Sammyjo20's full-sized avatar

Sam Carré Sammyjo20

View GitHub Profile
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
@Sammyjo20
Sammyjo20 / example.php
Created September 4, 2023 20:27
Saloon Custom Rate Limit Example
<?php
use Saloon\RateLimitPlugin\Limit;
use Saloon\Http\Response;
Limit::custom(function (Response $response, Limit $limit) {
$hasExceededLimit = (int)$response->header('x-ratelimit-remaining-requests') === 0;
if ($hasExceededLimit === true) {
$limit->exceeded($releaseInSeconds);
@Sammyjo20
Sammyjo20 / Pest.php
Created June 10, 2024 11:14
Lazy Man's Saloon Fake
/**
* Lazy Man's Saloon Fake
*
* This will record every request that you make in your application and store it in a folder
* based on the name of the test. This is incredibly powerful, but I wouldn't recommend it
* for every request if you are doing the same things over as it will waste API calls.
*
* @return void
*/
function lazyFakeSaloon(): void