Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created March 25, 2014 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/9754378 to your computer and use it in GitHub Desktop.
Save coreymcmahon/9754378 to your computer and use it in GitHub Desktop.
Examples of different response types that can be sent back using the Response facade in Laravel 4 - www.slashnode.com
<?php
// send back some HTML, rendered from a template
return Response::view('users.index', array(
'name' => 'Steve Brule',
'title' => 'Brule\'s Rules',
));
// send back some json
return Response::json(array(
'name' => 'Steve Brule',
'title' => 'Brule\'s Rules'
));
// send back a file
return Response::download(app_path('public/stevens-file.txt'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment