public function getBankNameAttribute($bank_name) { if ($bank_name) { return $bank_name; } $bankData = $this->bank_data; return $bankData ? $bankData->name : null; }