File Controller, Booking Organisation, import Draft, old arrangements
This commit is contained in:
parent
4eb83def39
commit
8fd1f4d451
289 changed files with 36649 additions and 10877 deletions
|
|
@ -13,17 +13,15 @@ class FileController extends Controller
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
public function __construct() {}
|
||||
|
||||
|
||||
public function show($id = null, $disk = null, $do='file')
|
||||
public function show($id = null, $disk = null, $do = 'file')
|
||||
{
|
||||
$path = "";
|
||||
$filename = "";
|
||||
|
||||
switch ($disk){
|
||||
switch ($disk) {
|
||||
case 'customer':
|
||||
$file = \App\Models\CustomerFile::findOrFail($id);
|
||||
$filename = $file->original_name;
|
||||
|
|
@ -66,25 +64,33 @@ class FileController extends Controller
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (file_exists($path)) {
|
||||
|
||||
// Cache-Control Header für PDFs und andere Dateien, die sich häufig ändern
|
||||
$headers = [
|
||||
'Cache-Control' => 'no-cache, no-store, must-revalidate',
|
||||
'Pragma' => 'no-cache',
|
||||
'Expires' => '0'
|
||||
];
|
||||
|
||||
switch ($do) {
|
||||
case 'file':
|
||||
return Response::file($path);
|
||||
return Response::file($path, $headers);
|
||||
break;
|
||||
case 'download':
|
||||
return Response::download($path, $filename);
|
||||
return Response::download($path, $filename, $headers);
|
||||
break;
|
||||
case 'url':
|
||||
return $path.$filename;
|
||||
return $path . $filename;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function showExpert($type = null, $class = null, $year = null, $file = null, $do = null) {
|
||||
public function showExpert($type = null, $class = null, $year = null, $file = null, $do = null)
|
||||
{
|
||||
|
||||
/*if ($type == 'xls') {
|
||||
$path = storage_path("app/export/");
|
||||
|
|
@ -92,35 +98,39 @@ class FileController extends Controller
|
|||
}*/
|
||||
$path = "";
|
||||
$filename = "";
|
||||
$headers = [];
|
||||
$headers = [
|
||||
'Cache-Control' => 'no-cache, no-store, must-revalidate',
|
||||
'Pragma' => 'no-cache',
|
||||
'Expires' => '0'
|
||||
];
|
||||
|
||||
if ($class === 'invoices' || $class === 'infos'){
|
||||
if ($class === 'invoices' || $class === 'infos') {
|
||||
$headers = [
|
||||
'Content-Type: application/pdf',
|
||||
'Pragma: no-cache',
|
||||
'Cache-Control: no-store,no-cache, must-revalidate, post-check=0, pre-check=0'
|
||||
];
|
||||
$dir = $year."/";
|
||||
$dir = $year . "/";
|
||||
$filename = $file;
|
||||
if ($type === 'fewo') {
|
||||
if(Storage::disk('fewo_invoices')->exists( $dir.$filename )){
|
||||
$path = Storage::disk('fewo_invoices')->path($dir.$filename);
|
||||
if (Storage::disk('fewo_invoices')->exists($dir . $filename)) {
|
||||
$path = Storage::disk('fewo_invoices')->path($dir . $filename);
|
||||
}
|
||||
}
|
||||
if ($type === 'fewo') {
|
||||
if(Storage::disk('fewo_infos')->exists( $dir.$filename )){
|
||||
$path = Storage::disk('fewo_infos')->path($dir.$filename);
|
||||
if (Storage::disk('fewo_infos')->exists($dir . $filename)) {
|
||||
$path = Storage::disk('fewo_infos')->path($dir . $filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($path)) {
|
||||
if($do === "download"){
|
||||
if ($do === "download") {
|
||||
return Response::download($path, $filename, $headers);
|
||||
}
|
||||
if($do === "file"){
|
||||
if ($do === "file") {
|
||||
return Response::file($path, $headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue