*/ protected $fillable = [ 'unique_id', 'region', 'branch_id', 'customer_name', 'customer_surname', 'customer_patronic_name', 'born_at', 'phone', 'passport_serie', 'passport_id', 'loan_contract_number', 'loan_contract_date', 'loan_amount', 'loan_reason', 'status', 'notes', 'user_id', ]; /** * The attributes that should be cast. * * @var array */ protected $casts = [ 'born_at' => 'date', ]; /** * User * * @return BelongsTo */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Branch * * @return BelongsTo */ public function branch(): BelongsTo { return $this->belongsTo(Branch::class, 'branch_id'); } /** * "boot" method for model */ protected static function boot() { parent::boot(); static::creating(LoanOrderRepo::creating()); static::created(LoanOrderRepo::created()); } }