Skip to content

Instantly share code, notes, and snippets.

Shankar Manamalkav mnshankar

Block or report user

Report or block mnshankar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mnshankar
mnshankar / routes.php
Last active Jun 13, 2017 — forked from coreymcmahon/routes.php
Using macros to implement custom response types in Laravel - www.slashnode.com
View routes.php
<?php
Response::macro('csv', function($data, $filename = 'data.csv', $status = 200, $delimiter = ",", $linebreak = "\n", $headers = array())
{
return Response::stream(function () use ($data, $delimiter, $linebreak) {
foreach ($data as $row) {
$keys = array(); $values = array();
$firstPassComplete = (isset($firstPassComplete)) ? true:false;
foreach ($row as $k => $v) {
if (!$firstPassComplete){
You can’t perform that action at this time.