예제 #1
0
파일: Plant.php 프로젝트: dawei101/plants
 public function getWaterTime()
 {
     return $this->hasOne(WaterTime::className(), ['user_id' => 'user_id']);
 }
예제 #2
0
파일: User.php 프로젝트: dawei101/plants
 public function afterSave($insert, $changedAttributes)
 {
     if ($insert) {
         $wf = new WaterTime();
         $wf->user_id = $this->id;
         $wf->morning = '6:00';
         $wf->noon = '12:00';
         $wf->afternoon = '18:00';
         $wf->save(false);
     }
     parent::afterSave($insert, $changedAttributes);
 }