add $attr for model and change definition structure for model