コード例 #1
0
ファイル: MCSetting.php プロジェクト: hoangngk/adminpanel
 /**
  * @establish a relationship with client or website model
  */
 public function getCow()
 {
     if ($this->belong_to == 1) {
         return $this->hasOne(Client::className(), ['id' => 'clients_or_webs_id']);
     } elseif ($this->belong_to == 2) {
         return $this->hasOne(Website::className(), ['id' => 'clients_or_webs_id']);
     }
 }
コード例 #2
0
ファイル: Coupon.php プロジェクト: priyankabarde/task-3
 public function getWebsite()
 {
     return $this->hasOne(Website::className(), ['WebsiteID' => 'WebsiteID']);
 }