Create a new macro class in Macros/Http
<?php
namespace App\Macros\Http;
use Illuminate\Support\Facades\Response as HttpResponse;
/**
*
*/
class Response
{
public static function registerMacros()
{
HttpResponse::macro('hello', function () {
return 'hello';
});
HttpResponse::macro('helloWorld', function ($name) {
return $name . ' said: hello world!';
});
HttpResponse::macro('pdf', function () {
return 'do something then generate the pdf';
});
}
}