*/ use HasFactory; use Uuid; use SoftDeletes; protected $fillable = [ 'reference', 'start_date', 'end_date', 'client_case_id', 'type_id', 'description' ]; protected $hidden = [ 'id', 'client_case_id', 'type_id' ]; public function type(): BelongsTo { return $this->belongsTo(\App\Models\ContractType::class, 'type_id'); } public function clientCase(): BelongsTo { return $this->belongsTo(\App\Models\ClientCase::class) ->with(['person']); } public function segments(): BelongsToMany { return $this->belongsToMany(\App\Models\Segment::class) ->withPivot('active', 'created_at') ->wherePivot('active', true); } public function account(): HasOne { return $this->hasOne(\App\Models\Account::class) ->with('type'); } public function objects(): HasMany { return $this->hasMany(\App\Models\CaseObject::class, 'contract_id'); } }