Check if ->can('env') before calling it.