<?php class Student extends Eloquent { protected $fillable = array('name', 'number', 'email', 'school_code', 'conc_code'); public function courses() { return $this->belongsToMany('Course')->withTimestamps(); } public function program() { return $this->belongsTo('Program'); } public function assessed_activities() { return $this->belongsToMany('Activity', 'assessments')->withPivot('scores', 'percentage')->withTimestamps(); } }