Example #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCircle()
 {
     return $this->hasOne(Circle::className(), ['id' => 'circle_id']);
 }
Example #2
0
 public function circle($id)
 {
     $circle = Circle::find($id);
     $temp = 0;
     foreach ($circle->enrollments as $enrollment) {
         if ($enrollment->people_id == Auth::user()->id) {
             $temp = 1;
             break;
         }
     }
     if ($temp == 0) {
         return 'You are not enrolled to this course!';
     }
     $circleList = Circle::all();
     $people = People::find(Auth::user()->id);
     return view('Pages.circlepage', compact('circle', 'circleList', 'people'));
 }