Ingen beskrivning

Activity.php 903B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. class Activity extends Eloquent
  3. {
  4. public function section()
  5. {
  6. return $this->belongsTo('Section');
  7. }
  8. public function rubric()
  9. {
  10. // return $this->belongsTo('Rubric');
  11. return $this->belongsToMany('Rubric','new_rubric_activity');
  12. }
  13. public function course()
  14. {
  15. return $this->belongsTo('Course');
  16. }
  17. public function assessed_students()
  18. {
  19. return $this->belongsToMany('Student', 'assessments')->withPivot('scores', 'percentage')->withTimestamps();
  20. }
  21. // cap_array
  22. public function getCapArrayAttribute($value)
  23. {
  24. return json_decode($this->criteria_achieved_percentage, true);
  25. }
  26. // o_ach_array
  27. public function getOAchArrayAttribute($value)
  28. {
  29. return json_decode($this->outcomes_achieved, true);
  30. }
  31. // o_att_array
  32. public function getOAttArrayAttribute($value)
  33. {
  34. return json_decode($this->outcomes_attempted, true);
  35. }
  36. }