Add MinIO helper functions

This commit is contained in:
Frank John Begornia
2026-02-23 01:27:12 +08:00
parent c0b275d8ff
commit b73b1762dc
2 changed files with 37 additions and 1 deletions

33
app/helpers.php Normal file
View File

@@ -0,0 +1,33 @@
<?php
if (!function_exists('minio_url')) {
/**
* Generate MinIO URL for a file
*
* @param string $path File path relative to bucket
* @return string Full MinIO URL
*/
function minio_url($path)
{
$bucket = env('MINIO_BUCKET', 'crew-admin');
$baseUrl = env('MINIO_URL', 'https://minio.crewsportswear.app');
// Remove leading slash if present
$path = ltrim($path, '/');
return $baseUrl . '/' . $bucket . '/' . $path;
}
}
if (!function_exists('minio_image_url')) {
/**
* Generate MinIO URL for an image in uploads/images/
*
* @param string $filename Image filename
* @return string Full MinIO URL
*/
function minio_image_url($filename)
{
return minio_url('uploads/images/' . $filename);
}
}