14 lines
752 B
PHP
14 lines
752 B
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
// Public immutable code assets only. Outside functional module/auth guards so
|
|
// login and general navigation can load before a module is selected.
|
|
Route::get('/build/modules/internal-requisitions/assets/{asset}', function (string $asset) {
|
|
abort_unless(preg_match('/^[A-Za-z0-9_-]+\.(js|css)$/D', $asset), 404);
|
|
$file = dirname(__DIR__).'/frontend/assets/'.$asset;
|
|
abort_unless(is_file($file) && ! is_link($file), 404);
|
|
|
|
return response()->file($file, ['Content-Type' => str_ends_with($asset, '.js') ? 'application/javascript' : 'text/css', 'X-Content-Type-Options' => 'nosniff', 'Cache-Control' => 'public, max-age=31536000, immutable']);
|
|
})->where('asset', '[A-Za-z0-9_-]+\.(js|css)');
|