Files
kreios/backoffice/app/Http/Controllers/Api/MediaController.php
carmine.savino 06617a985a feat: add previous configuration handling for user selections in quotes
- Implemented session storage management for the last configuration choices made by the user.
- Added functionality to prompt users when changing models to retain their previous selections.
- Introduced methods to apply previous choices to the newly loaded model, including finishes, handles, glass types, and options.
- Enhanced user experience by ensuring selections are automatically applied where applicable.
2026-10-19 19:49:44 +02:00

34 lines
937 B
PHP

<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Support\Configuratore\Media;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class MediaController extends Controller
{
/**
* GET /api/media/{percorso}
* Immagini del configuratore dal disco public, con gli header CORS dell'API (necessari
* alle texture WebGL caricate da un'altra origine).
*/
public function __invoke(string $percorso): BinaryFileResponse
{
$disco = Storage::disk('public');
abort_if(
str_contains($percorso, '..')
|| ! Str::startsWith($percorso, Media::CARTELLE)
|| ! $disco->exists($percorso),
404
);
return response()->file($disco->path($percorso), [
'Cache-Control' => 'public, max-age=86400',
]);
}
}