Nav apraksta

Objective.php 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. use Illuminate\Database\Eloquent\SoftDeletingTrait;
  3. class Objective extends Eloquent
  4. {
  5. use SoftDeletingTrait;
  6. protected $fillable = array('text', 'outcome_id', 'active');
  7. protected $table = 'objectives';
  8. /**
  9. * Return the program that the objective belongs to
  10. *
  11. * @return Illuminate\Database\Eloquent\Model
  12. */
  13. public function program()
  14. {
  15. return $this->belongsTo('Program');
  16. }
  17. /**
  18. * Return the outcomes that the objective belongs to
  19. *
  20. * @return Illuminate\Database\Eloquent\Model
  21. */
  22. public function outcomes()
  23. {
  24. return $this->belongsToMany('Outcome', 'objective_outcome', 'objective_id', 'outcome_id');
  25. }
  26. public function outcome()
  27. {
  28. return $this->belongsTo('Outcome');
  29. }
  30. /**
  31. * Return the program that the objective belongs to
  32. *
  33. * @return Illuminate\Database\Eloquent\Model
  34. */
  35. public function outcome_id()
  36. {
  37. return $this->hasMany('Objective_Outcome', 'objective_id');
  38. }
  39. }