コード例 #1
0
ファイル: Menu.php プロジェクト: worstinme/yii2-zoo
 public function getUrl()
 {
     if ($this->type == 4) {
         return \yii\helpers\Json::decode($this->url);
     } elseif ($this->type == 5) {
         return $this->url;
     } elseif ($this->type == 1) {
         if (($application = Applications::findOne($this->application_id)) !== null) {
             return $application->url;
         }
     } elseif ($this->type == 2) {
         if (($category = Categories::findOne($this->category_id)) !== null) {
             return $category->url;
         }
     } elseif ($this->type == 3) {
         $item = Items::find()->where([Items::tablename() . '.id' => $this->item_id])->one();
         if ($item !== null) {
             return $item->url;
         }
     }
     return '#';
 }