From 8144d2e5176f6c4b3e667a627965fd5f03b66962 Mon Sep 17 00:00:00 2001 From: Harish Toshniwal Date: Fri, 20 Jul 2018 04:46:33 +0530 Subject: [PATCH] fix explanation of automatic foreign key detection --- eloquent-relationships.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eloquent-relationships.md b/eloquent-relationships.md index 48d7976c925..28dc41eb36b 100644 --- a/eloquent-relationships.md +++ b/eloquent-relationships.md @@ -225,7 +225,7 @@ Once the relationship has been defined, we can retrieve the `Post` model for a ` echo $comment->post->title; -In the example above, Eloquent will try to match the `post_id` from the `Comment` model to an `id` on the `Post` model. Eloquent determines the default foreign key name by examining the name of the relationship method and suffixing the method name with `_id`. However, if the foreign key on the `Comment` model is not `post_id`, you may pass a custom key name as the second argument to the `belongsTo` method: +In the example above, Eloquent will try to match the `post_id` from the `Comment` model to an `id` on the `Post` model. Eloquent determines the default foreign key name by examining the name of the relationship method and suffixing the method name with a `_` followed by the name of the primary key column. However, if the foreign key on the `Comment` model is not `post_id`, you may pass a custom key name as the second argument to the `belongsTo` method: /** * Get the post that owns the comment.