Get last item of an array

Use array_key_last() to get last key. Do not use end(), if the item contain objects, end() will cause error.

Use Laravel Collection Object