public function exportCustomerData() { $customers = CustomerData::orderBy('id')->get(); $customers = $customers->toArray(); $filename = CustomerData::exportData($customers); return Response::download(public_path($filename)); }