getRequestValue('id', 0) > 0) { return (int)$this->getRequestValue('id', 0); } if ((int)$this->getRequestValue('productselect', 0) > 0) { return (int)$this->getRequestValue('productselect', 0); } return $this->getServiceIdByUserId(); } public function getServiceIdByUserId() { $hosting = Hosting::where([ 'userid' => $this->getRequestValue('userid', 0) ])->orderBy('domain', 'ASC')->first(); return $hosting->id; } }