12345678910111213141516171819202122232425262728293031323334 |
- <?php
-
- use Illuminate\Database\Eloquent\SoftDeletingTrait;
-
- class Outcome extends Eloquent
- {
- use SoftDeletingTrait;
- protected $dates = ['deleted_at'];
-
- protected $fillable= array('name', 'definition');
-
- public function criteria()
- {
- return $this->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();
- }
- }
|