project_directory/app/helpers.php
2026-02-05 09:39:23 +07:00

27 lines
600 B
PHP

<?php
use Illuminate\Support\Facades\Storage;
if(!function_exists('ver')){
function ver($path){
$fullPath = public_path($path);
return asset($path) . '?v=' . (file_exists($fullPath) ? filemtime($fullPath) : time());
}
}
if (!function_exists('get_file_s3')) {
function get_file_s3($path)
{
if (!Storage::disk('s3')->exists($path)) {
return false;
}
$file = Storage::disk('s3')->get($path);
$mime = Storage::disk('s3')->mimeType($path);
return [
'file' => $file,
'mime' => $mime
];
}
}