Files
getgreen-backend/app/Models/ContractTemplate.php
2026-04-16 04:05:10 +05:00

42 lines
852 B
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
/**
* @package App\Models
* @property integer $id
* @property string $path
* @property string $lang
* @property string $type
*
* @method string full_path()
*/
class ContractTemplate extends Model
{
use HasFactory;
protected $fillable = [
'path',
'lang',
"company",
'type',
];
public function full_path(): string
{
if (!empty($this->path)) {
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
return Storage::url($this->path);
}
return '/' . $this->path;
}
return asset('storage/' . $this->path);
}
}