/** * @param $value * * @return mixed|string */ public function getAddressAttribute($value) { if ($this->category == 'move') { $wallet = Wallet::find((int) $this->otheraccount); if ($wallet) { return $wallet->address; } return ''; } else { return $value; } }