<?php

namespace App\Http\Controllers;

use App\Repositories\FileRepository;

class FileController extends Controller {
    public function assets($file) {
        try {
            $path = FileRepository::asset($file);
        }
        catch(\Exception $e) { return response()->json(["error" => "Error obteniendo la imagen: " . $e->getMessage()]); }

        return response()->download($path);
    }

    public function storage($file) {
        try {
            $path = FileRepository::storage($file);
        }
        catch(\Exception $e) { return response()->json(["error" => "Error obteniendo la imagen: " . $e->getMessage()]); }

        return response()->download($path);
    }
}
