0
단어 파일을 보고서로 만들고 싶습니다. 테이블에서 모든 데이터를 가져와 단어 파일에 저장하려고하지만 파일에 데이터를 저장할 수 없습니다. 나는 laravel 5.2에서하고있다. 파일이 생성되고 다운로드되지만 데이터베이스에서 오는 데이터가 저장되지 않습니다. 모두에게 감사합니다 내 컨트롤러 코드는 다음과 같습니다 -laravel에서 데이터베이스의 단어 파일에 데이터를 저장하는 방법
public function downloadAbleFile(Request $request){
//Fetching all records based on projectid
$project_id = $request->input('project_id');
$questiondetails = DB::table('questionnair')->where('project_id','=',$project_id)->get();
$headers = array(
"Content-type"=>"text/html",
"Content-Disposition"=>"attachment;Filename=report.doc"
);
$content = '<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>
<table>
<thead>
<tr>
<th>Project ID</th>
<th>Question Number</th>
<th>User ID</th>
<th>Answer</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
function project(){
foreach ($questiondetails as $question){
return(
echo "<tr>";
echo "<td>".$question->project_id."</td>";
echo "<td>".$question->question_num."</td>";
echo "<td>".$question->user_id."</td>";
echo "<td>".$question->answer."</td>";
echo "<td>".$question->status."</td>";
echo "</tr>";
);
}
}
project();
?>
</tbody>
</table>
</p>
</body>
</html>';
return Response::make($content,200, $headers);
}