<?php

use Illuminate\Database\Eloquent\SoftDeletingTrait;

class Objective extends Eloquent
{
    use SoftDeletingTrait;
    protected $fillable = array('text', 'outcome_id', 'program_id', 'active');
    protected $table = 'objectives';

    /**
     * Return the program that the objective belongs to
     *
     * @return Illuminate\Database\Eloquent\Model
     */
    public function program()
    {
        return $this->belongsTo('Program');
    }

    /**
     * Return the outcomes that the objective belongs to
     *
     * @return Illuminate\Database\Eloquent\Model
     */

    public function outcomes()
    {
        return $this->belongsToMany('Outcome', 'objective_outcome', 'objective_id', 'outcome_id');
    }

    public function outcome()
    {
        return $this->belongsTo('Outcome');
    }

    /**
     * Return the program that the objective belongs to
     *
     * @return Illuminate\Database\Eloquent\Model
     */
    public function outcome_id()
    {
        return $this->hasMany('Objective_Outcome', 'objective_id');
    }
}
