signupDb = new SignupData(); $this->trackDataDb = new TrackData(); } public function insertData($name, $email, $mobile, $trackId) { $this->signupDb ->insert([ 'name' => $name, 'email' => $email, 'mobile' => $mobile, 'trackId' => $trackId, 'createDate' => date("Y-m-d H:i:s"), ]); } public function overLimitOrNot($trackId) { $nowCount = $this->signupDb ->where('trackId', '=', $trackId) ->count(); $limit = $this->trackDataDb ->select('trackLimit') ->where('trackNo', '=', $trackId) ->first(); if ($limit->trackLimit>$nowCount) { return true; } else { return false; } } public function getData() { $res = $this->trackDataDb ->select([ '*' ]) ->get(); dd($res); // 整理返回值並返回 return $res; } }