Is there any row that satisfies the where condition? If not, your query will return null and you cannot retrieve the id property. Anway you don't need get() if you want to use first().
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.