<?php class FypPart extends \Eloquent { protected $fillable = ['five_year_plan_id', 'year_start', 'year_end']; // return all the outcomes in the the five year part plan public function fypPartOutcomes() { return $this->hasMany('FypPartOutcome'); } public function willAssessOutcome($outcome_id) { $q = FypPartOutcome:: where('fyp_part_id', $this->id) ->where('outcome_id', $outcome_id) ->first(); if($q) { return true; } else { return false; } } }