public function excel_exports($input, $p_id) {
$find = new Project();
$tmp_name = time();
$path = storage_path("files/" . $p_id);
if (!is_dir($path)) {
umask(0);
mkdir($path, 0777, true);
chmod($path, 0777);
}
$project = new Project();
$prodata = $project->getById($p_id);
$zipfile = $prodata->id.'.zip';
$excelname = $prodata->id;
$data = $findingObj->getAll($p_id);
$colspan = 1;
foreach ($data as $row) {
$this->_saveDocumentsFiles($row);
$doc_cc = 0;
foreach ($row->document as $doc) {
$doc_cc = $doc_cc + $doc->doc_files->count();
}
if ($doc_cc > $colspan) {
$colspan = $doc_cc;
}
}
Excel::create($excelname, function($excel) use ($data, $colspan) {
$excel->sheet('projectfinding', function($sheet) use ($data, $colspan) {
$sheet->loadView('admin.project.finding.excel_file_exports')->with(["targetRow" => 5, "targetCol" => "A", "targetView" => "admin.project.finding.excel_pdf", 'data' => $data, 'colspan' => $colspan]);
});
})->save('xls', $path, false);
$source = storage_path('files');
$this->zip($source, $zipfile);
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=$zipfile");
readfile($zipfile);
unlink(public_path($zipfile));
$rmpath = storage_path("files/" . $p_id);
$this->_rrmdir($rmpath);
return true;
}
in this code i simply change p_id with id it will show error in $path and $rmpath