Files
star-erp/app/Modules/Finance/Models/UtilityFeeAttachment.php
sky121113 8e0252e8fc
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
[FEAT] 實作公共事業費附件上傳管理與更新 UI 協作規範防呆機制
2026-03-06 13:21:14 +08:00

37 lines
718 B
PHP

<?php
namespace App\Modules\Finance\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Facades\Storage;
class UtilityFeeAttachment extends Model
{
protected $fillable = [
'utility_fee_id',
'file_path',
'original_name',
'mime_type',
'size',
];
protected $appends = ['url'];
/**
* 附件所属的公共事業費
*/
public function utilityFee(): BelongsTo
{
return $this->belongsTo(UtilityFee::class);
}
/**
* 獲取附件的全路徑 URL
*/
public function getUrlAttribute()
{
return tenant_asset($this->file_path);
}
}