暂无描述

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. use Illuminate\Database\Eloquent\SoftDeletingTrait;
  3. class Criterion extends Eloquent
  4. {
  5. use SoftDeletingTrait;
  6. protected $dates = ['deleted_at'];
  7. protected $table = 'new_criteria';
  8. public function outcomes()
  9. {
  10. // return $this->belongs('Objective')->belongs('Outcome');
  11. // TODO: Changes here
  12. // return $this->belongs('Outcome');
  13. return $this->hasManyThrough('Outcome', 'Objective');
  14. }
  15. public function objectives()
  16. {
  17. return $this->belongsToMany('Objective');
  18. }
  19. public function rubrics()
  20. {
  21. return $this->belongsToMany('Rubric', 'new_criterion_rubric');
  22. }
  23. /**
  24. * Return the program that the criterion belongs to
  25. *
  26. * @return Illuminate\Database\Eloquent\Model
  27. */
  28. public function program()
  29. {
  30. return $this->belongsTo('Program');
  31. }
  32. public function subcriteria()
  33. {
  34. return json_decode($this->subcriteria);
  35. }
  36. }