<?php
namespace AppTraits;
use IlluminateSupportStr;
use IlluminateHttpUploadedFile;
use IlluminateSupportFacadesStorage;
trait Upload
{
public function UploadFile(UploadedFile $file, $folder = null, $disk = 'public', $filename = null)
{
$FileName = !is_null($filename) ? $filename : Str::random(10);
return $file->storeAs(
$folder,
$FileName . "." . $file->getClientOriginalExtension(),
$disk
);
}
public function deleteFile($path, $disk = 'public')
{
Storage::disk($disk)->delete($path);
}
}