27 lines
600 B
PHP
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
|
|
];
|
|
}
|
|
}
|