06.10.2016 Views

laravel-5

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

HTTP Responses 165<br />

16 {<br />

17 Response::macro('caps', function ($value) {<br />

18 return Response::make(strtoupper($value));<br />

19 });<br />

20 }<br />

21 }<br />

The macro function accepts a name as its first argument, and a Closure as its second. The macro’s<br />

Closure will be executed when calling the macro name from a ResponseFactory implementation or<br />

the response helper:<br />

1 return response()->caps('foo');

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!