Tutorial
4 min read
Free
Laravel Relation "Attempt to read property on null" Error: 4 Possible Solutions
When using a relationship, have you ever seen an error like "Attempt to read property on null"? It usually means that the related record is NULL or soft-deleted. There are multiple ways to gracefully handle such a situation, without showing the error to the user.