*/ protected $fillable = [ 'unique_id', 'loan_type', 'region', 'branch_id', 'customer_name', 'customer_surname', 'customer_patronic_name', 'passport_address', 'real_address', 'passport_serie', 'passport_id', 'passport_given_at', 'passport_given_by', 'born_place', 'born_at', 'email', 'phone', 'phone_additional', 'phone_home', 'work_region', 'work_province_id', 'work_company', 'work_company_accountant_number', 'work_started_at', 'work_salary', 'work_position', 'education', 'marriage_status', 'passport_one', 'passport_two', 'passport_three', 'passport_four', 'user_id', 'status', 'status_reason', 'notes', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'born_at' => 'date', 'passport_given_at' => 'date', 'work_started_at' => 'date', ]; /** * Loan type */ public function loanType(): BelongsTo { return $this->belongsTo(LoanType::class, 'loan_type'); } /** * Branch */ public function branch(): BelongsTo { return $this->belongsTo(Branch::class); } /** * Work province */ public function workProvince(): BelongsTo { return $this->belongsTo(Province::class, 'province_id'); } /** * User (who created order) */ public function user(): BelongsTo { return $this->belongsTo(User::class, 'user_id'); } }