hasManyThrough('Criterion', 'Objective')->orderBy('name'); } /** * Return the objectives that the outcome belongs to * * @return Illuminate\Database\Eloquent\Model */ public function objectives() { return $this->hasMany('Objective'); // return $this->belongsToMany('Objective', 'objective_outcome'); } public static function active() { //TODO: Check when semester doesnt exist or session is empty $selected_semester = Semester::find(Session::get('semesters_ids')[0]); return Outcome::withTrashed()->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null)->orderBy('name', 'ASC')->get(); } }