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.
A practical example would be a list of Posts with belongs To relation to Categories.
Migration file for Posts:
1 2 3 |
Schema::table('posts', function (Blueprint $table) { $table->foreignId('category_id')->nullable()->constrained(); }); |