Last active
February 22, 2018 16:34
-
-
Save imanghafoori1/ec8f653ccbe4858c0a4343e7c522b032 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sendAndExit($response) | |
{ | |
$request = app('request'); | |
// send the response to the users browser | |
app('router')->prepareResponse($request, $response)->send(); | |
// dispatches an event | |
app('events')->dispatch(new \Illuminate\Foundation\Http\Events\RequestHandled($request, $response)); | |
// this is just needed when we have terminable middlewares in our app. | |
app(\Illuminate\Contracts\Http\Kernel::class)->terminate($request, $response); | |
exit; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment