public function scopeActiveOn($query, $period)
    {
        return $query->whereHas('periods', function($query) use ($period){
            $query->where('academic_periods_id', $period);
        });
    }