first commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\Uuid;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class Contract extends Model
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\ContractFactory> */
|
||||
use HasFactory;
|
||||
use Uuid;
|
||||
|
||||
protected $fillable = [
|
||||
'reference',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'client_id',
|
||||
'debtor_id',
|
||||
'type_id',
|
||||
'description'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'client_id',
|
||||
'debtor_id',
|
||||
'type_id'
|
||||
];
|
||||
|
||||
public function type(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(\App\Models\ContractType::class, 'type_id');
|
||||
}
|
||||
|
||||
public function debtor(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(\App\Models\Person\Person::class, 'debtor_id');
|
||||
}
|
||||
|
||||
public function segments(): BelongsToMany {
|
||||
return $this->belongsToMany(\App\Models\Segment::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user