Trying to get property 'teacher_id' of non-object