laravel looping checking if last record has reached

Solutions on MaxInterview for laravel looping checking if last record has reached by the best coders in the world