*/ use HasFactory; protected $attributes = [ 'status' => LoanStatus::Submitted->value, ]; public function getRouteKeyName(): string { return 'public_id'; } public function loanType(): BelongsTo { return $this->belongsTo(LoanType::class); } public function workflowConfiguration(): BelongsTo { return $this->belongsTo(WorkflowConfiguration::class); } public function currentStep(): BelongsTo { return $this->belongsTo(WorkflowConfigurationStep::class, 'current_workflow_configuration_step_id'); } public function histories(): HasMany { return $this->hasMany(LoanHistory::class); } /** * @return array */ protected function casts(): array { return [ 'amount' => 'integer', 'monthly_income' => 'integer', 'credit_score' => 'integer', 'has_guarantor' => 'boolean', 'status' => LoanStatus::class, ]; } }