Last active
January 22, 2024 11:36
-
-
Save 1isten/2b65ebc66d9486d03940a5dce873bccc to your computer and use it in GitHub Desktop.
Revisions
-
1isten revised this gist
Jan 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ // ... Route::fallback(function () { $static = 'static'; // static folder in project root $static_file = request()->path() === '/' ? base_path($static) : implode(DIRECTORY_SEPARATOR, array_merge(array(base_path($static)), explode('/', request()->path()))); if (is_dir($static_file)) { $static_file = implode(DIRECTORY_SEPARATOR, array($static_file, 'index.html')); -
1isten revised this gist
Jan 22, 2024 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,14 @@ $static_file = implode(DIRECTORY_SEPARATOR, array($static_file, 'index.html')); } if (file_exists($static_file)) { $mimeType = \GuzzleHttp\Psr7\MimeType::fromFilename($static_file); return response()->file($static_file, [ // 'Cache-Control' => 'public,max-age=0,must-revalidate', 'Content-Type' => $mimeType ? $mimeType : 'application/octet-stream', ]); } return response([ 'error' => 404, 'message' => '404 Not Found', ], 404); }); -
1isten revised this gist
Jan 22, 2024 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ <?php // Route::get('/', ... // ... -
1isten created this gist
Jan 22, 2024 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // Route::get('/', ... // ... Route::fallback(function () { $static = 'static'; $static_file = request()->path() === '/' ? base_path($static) : implode(DIRECTORY_SEPARATOR, array_merge(array(base_path($static)), explode('/', request()->path()))); if (is_dir($static_file)) { $static_file = implode(DIRECTORY_SEPARATOR, array($static_file, 'index.html')); } if (file_exists($static_file)) { return response()->file($static_file, ['Content-Type' => \GuzzleHttp\Psr7\MimeType::fromFilename($static_file)]); } return response(['error' => 404, 'message' => '404 Not Found'], 404); });