Laravel - HTTP Client - Fake Callback

If you require more complicated logic to determine what responses to return for certain endpoints, you may pass a closure to the fake method. This closure will receive an instance of Illuminate\Http\Client\Request and should return a response instance. Within your closure, you may perform whatever logic is necessary to determine what type of response to return:

    
    Http::fake(function ($request) {
        return Http::response('Hello World', 200);
    });