<?php class FiveYearPlan extends \Eloquent { protected $fillable = ['program_id', 'quinquennium_id', 'is_submitted', 'submitted_on']; // return all the parts in the five year plan public function fypParts() { return $this->hasMany('FypPart'); } // return all the outcomes in the plan public function outcomes() { return $this->hasManyThrough('FypPartOutcome', 'FypPart'); } // return the quinquennium the five year plan belongs to public function quinquennium() { return $this->belongsTo('Quinquennium'); } // return the program the plan belongs to public function program() { return $this->belongsTo('Program'); } }