예제 #1
0
 public static function boot()
 {
     parent::boot();
     Course::creating(function ($course) {
         $course->code = $course->generateCode();
     });
 }
예제 #2
0
 public function courseById($course_id)
 {
     $course = Course::find($course_id);
     return $course;
 }
예제 #3
0
 public function courseMemberStatus($slug)
 {
     $course_id = Course::findBySlug($slug);
     $member_course = CourseMember::where('course_id', $course_id->id)->where('user_id', sentinel()->getUser()->id)->get();
     return $member_course;
 }
예제 #4
0
 public function update($name, $description, $days, $category)
 {
     $this->model = Course::update(compact('name', 'description', 'days'));
     $this->attachCategory($category);
     return $this;
 }