41 lines
989 B
PHP
41 lines
989 B
PHP
<?php
|
|
|
|
namespace Modules\FinancialManagement\Models;
|
|
|
|
use App\Traits\HasPublicIdentifier;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Modules\ProjectManagement\Models\Project;
|
|
|
|
class RetentionEntry extends Model
|
|
{
|
|
use HasPublicIdentifier;
|
|
|
|
protected $table = 'retention_ledger';
|
|
|
|
protected $fillable = [
|
|
'project_id', 'invoice_id', 'type', 'status', 'amount', 'description',
|
|
'media_path', 'media_original_name', 'submitted_by', 'paid_by',
|
|
'submitted_at', 'paid_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'amount' => 'decimal:2',
|
|
'submitted_at' => 'datetime',
|
|
'paid_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function project(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function invoice(): BelongsTo
|
|
{
|
|
return $this->belongsTo(FinancialInvoice::class, 'invoice_id');
|
|
}
|
|
}
|