Created
March 25, 2014 02:46
-
-
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
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 | |
// 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