laravel wherehas undefined variable

Solutions on MaxInterview for laravel wherehas undefined variable by the best coders in the world