hasOne(Massager::class, 'id', 'massager_id'); } function getWallet($m_id) { $w = $this->where("massager_id", $m_id)->find(); if ($w) return $w; return self::create([ "massager_id" => $m_id, "score" => 0, "profit_amount" => 0, "total_profit_amount" => 0, "createtime" => time(), "updatetime" => time() ]); } }