<?php
namespace App\Services\Upload;

use Illuminate\Support\Facades\Storage;

class FileService
{
    public static function uploadImage($image)
    {
        $newFileName = rand(10000,99999).time().'.'.$image->getClientOriginalName();
        $destinationPath = public_path('/storages/images');
        $image->move($destinationPath, $newFileName);

        return '/storages/images/'.$newFileName;
    }
    public static function uploadVideo($video)
    {
        $newFileName = rand(10000,99999).time().'.'.$video->getClientOriginalName();
        $destinationPath = public_path('/storages/videos');
        $video->move($destinationPath, $newFileName);

        return '/storages/videos/'.$newFileName;
    }
    public static function uploadFile($file)
    {
        $newFileName = rand(10000,99999).time().'.'.$file->getClientOriginalName();
        $destinationPath = public_path('/storages/files');
        $file->move($destinationPath, $newFileName);

        return '/storages/files/'.$newFileName;
    }
}
