暫無描述

Outcome.php 940B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. use Illuminate\Database\Eloquent\SoftDeletingTrait;
  3. class Outcome extends Eloquent
  4. {
  5. use SoftDeletingTrait;
  6. protected $dates = ['deleted_at'];
  7. protected $fillable= array('name', 'definition');
  8. public function criteria()
  9. {
  10. return $this->hasManyThrough('Criterion', 'Objective')->orderBy('name');
  11. }
  12. /**
  13. * Return the objectives that the outcome belongs to
  14. *
  15. * @return Illuminate\Database\Eloquent\Model
  16. */
  17. public function objectives()
  18. {
  19. return $this->hasMany('Objective');
  20. // return $this->belongsToMany('Objective', 'objective_outcome');
  21. }
  22. public static function active()
  23. {
  24. //TODO: Check when semester doesnt exist or session is empty
  25. $selected_semester = Semester::find(Session::get('semesters_ids')[0]);
  26. return Outcome::withTrashed()->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null)->orderBy('name', 'ASC')->get();
  27. }
  28. }