This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 847
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from crocodic-studio/5.2
bug fix route and improve
- Loading branch information
Showing
5 changed files
with
259 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ public function boot() | |
|
||
require __DIR__.'/routes.php'; | ||
require __DIR__.'/helpers/Helper.php'; | ||
|
||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php namespace crocodicstudio\crudbooster\controllers; | ||
|
||
use crocodicstudio\crudbooster\controllers\Controller; | ||
use Illuminate\Support\Facades\Session; | ||
use Illuminate\Support\Facades\Storage; | ||
use Illuminate\Support\Facades\Request; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\App; | ||
use Illuminate\Support\Facades\Mail; | ||
use Illuminate\Support\Facades\Route; | ||
use Illuminate\Support\Facades\Hash; | ||
use Illuminate\Support\Facades\Cache; | ||
use Illuminate\Support\Facades\Validator; | ||
use Illuminate\Support\Facades\PDF; | ||
use Illuminate\Support\Facades\Excel; | ||
|
||
class UploadsController extends Controller { | ||
|
||
public function getFile($folder, $filename) { | ||
$path = storage_path() . DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $filename; | ||
|
||
if(!File::exists($path)) abort(404); | ||
|
||
$file = File::get($path); | ||
$type = File::mimeType($path); | ||
$response = Response::make($file, 200); | ||
$response->header("Content-Type", $type); | ||
|
||
$seconds_to_cache = 3600 * (24*30); | ||
$gmt_mtime = gmdate('D, d M Y H:i:s', time() ) . ' GMT'; | ||
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT"; | ||
$response->header("Expires",$ts); | ||
$response->header("Last-Modified",$gmt_mtime); | ||
$response->header("Pragma","cache"); | ||
$response->header("Cache-Control","max-age=$seconds_to_cache, must-revalidate"); | ||
return $response; | ||
} | ||
} |
Oops, something went wrong.