mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-10-01 09:13:19 -04:00
37 lines
833 B
PHP
37 lines
833 B
PHP
<?php
|
|
|
|
namespace Modules\RegistrationAgreement\Traits;
|
|
|
|
use Illuminate\Http\File;
|
|
use Illuminate\Http\UploadedFile;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
trait UploadPDF
|
|
{
|
|
/**
|
|
* Base filepath for image upload.
|
|
*
|
|
* @var string
|
|
*/
|
|
public $base_path = 'pdfs';
|
|
|
|
/**
|
|
* Upload a license image.
|
|
*
|
|
* @param \Illuminate\Http\File|\Illuminate\Http\UploadedFile $file
|
|
* @param integer $id
|
|
* @param string $disk
|
|
* @return string|false
|
|
*/
|
|
public function uploadPDF(File|UploadedFile $file, string $filepath = '', string $disk = 's3')
|
|
{
|
|
$path = $this->base_path;
|
|
|
|
if ($filepath !== '') {
|
|
$path .= '/' . ltrim($filepath, '/');
|
|
}
|
|
|
|
return Storage::disk($disk)->putFile($path, $file);
|
|
}
|
|
}
|