[FEAT] 實作公共事業費附件上傳管理與更新 UI 協作規範防呆機制
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 55s
This commit is contained in:
36
app/Modules/Finance/Models/UtilityFeeAttachment.php
Normal file
36
app/Modules/Finance/Models/UtilityFeeAttachment.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user