Laravel 5.6 OneToOne relation not working












0















I have a BuildingImage model with a OneToOne relation to BuildingType:



BuildImage Model:



/**
* Get the source type of the Building Image.
*/
public function type()
{
return $this->hasOne('AppBuildingType');
}


BuildingType Model:



/**
* Get the Building Image that owns the building type.
*/
public function buildingImage()
{
return $this->belongsTo('AppBuildingImage');
}


My tables:



building_images table -> source is the building type id



source is the building type id



building_types table



enter image description here



When I try to do this in my controller just to test:
(an ImageRequest has one or more Builings and a Building has one BuildingType)



$imageRequest = ImageRequest::findOrFail($id);

$buildings = $imageRequest->buildingImages;

foreach ($buildings as $building) {
dd($building->type);
}


I get this error:




SQLSTATE[42S22]: Column not found: 1054 Unknown column
'building_types.building_image_id' in 'where clause' (SQL: select *
from building_types where building_types.building_image_id = 45
and building_types.building_image_id is not null limit 1)




What am I doing wrong here?










share|improve this question





























    0















    I have a BuildingImage model with a OneToOne relation to BuildingType:



    BuildImage Model:



    /**
    * Get the source type of the Building Image.
    */
    public function type()
    {
    return $this->hasOne('AppBuildingType');
    }


    BuildingType Model:



    /**
    * Get the Building Image that owns the building type.
    */
    public function buildingImage()
    {
    return $this->belongsTo('AppBuildingImage');
    }


    My tables:



    building_images table -> source is the building type id



    source is the building type id



    building_types table



    enter image description here



    When I try to do this in my controller just to test:
    (an ImageRequest has one or more Builings and a Building has one BuildingType)



    $imageRequest = ImageRequest::findOrFail($id);

    $buildings = $imageRequest->buildingImages;

    foreach ($buildings as $building) {
    dd($building->type);
    }


    I get this error:




    SQLSTATE[42S22]: Column not found: 1054 Unknown column
    'building_types.building_image_id' in 'where clause' (SQL: select *
    from building_types where building_types.building_image_id = 45
    and building_types.building_image_id is not null limit 1)




    What am I doing wrong here?










    share|improve this question



























      0












      0








      0








      I have a BuildingImage model with a OneToOne relation to BuildingType:



      BuildImage Model:



      /**
      * Get the source type of the Building Image.
      */
      public function type()
      {
      return $this->hasOne('AppBuildingType');
      }


      BuildingType Model:



      /**
      * Get the Building Image that owns the building type.
      */
      public function buildingImage()
      {
      return $this->belongsTo('AppBuildingImage');
      }


      My tables:



      building_images table -> source is the building type id



      source is the building type id



      building_types table



      enter image description here



      When I try to do this in my controller just to test:
      (an ImageRequest has one or more Builings and a Building has one BuildingType)



      $imageRequest = ImageRequest::findOrFail($id);

      $buildings = $imageRequest->buildingImages;

      foreach ($buildings as $building) {
      dd($building->type);
      }


      I get this error:




      SQLSTATE[42S22]: Column not found: 1054 Unknown column
      'building_types.building_image_id' in 'where clause' (SQL: select *
      from building_types where building_types.building_image_id = 45
      and building_types.building_image_id is not null limit 1)




      What am I doing wrong here?










      share|improve this question
















      I have a BuildingImage model with a OneToOne relation to BuildingType:



      BuildImage Model:



      /**
      * Get the source type of the Building Image.
      */
      public function type()
      {
      return $this->hasOne('AppBuildingType');
      }


      BuildingType Model:



      /**
      * Get the Building Image that owns the building type.
      */
      public function buildingImage()
      {
      return $this->belongsTo('AppBuildingImage');
      }


      My tables:



      building_images table -> source is the building type id



      source is the building type id



      building_types table



      enter image description here



      When I try to do this in my controller just to test:
      (an ImageRequest has one or more Builings and a Building has one BuildingType)



      $imageRequest = ImageRequest::findOrFail($id);

      $buildings = $imageRequest->buildingImages;

      foreach ($buildings as $building) {
      dd($building->type);
      }


      I get this error:




      SQLSTATE[42S22]: Column not found: 1054 Unknown column
      'building_types.building_image_id' in 'where clause' (SQL: select *
      from building_types where building_types.building_image_id = 45
      and building_types.building_image_id is not null limit 1)




      What am I doing wrong here?







      php laravel eloquent relationship






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 '18 at 17:01









      Ram Bhandari

      361216




      361216










      asked Nov 15 '18 at 15:15









      MichaelMichael

      164110




      164110
























          3 Answers
          3






          active

          oldest

          votes


















          1














          Your BuildImage model should be



          /**
          * Get the source type of the Building Image.
          */



          public function type() {
          return $this->hasOne('AppBuildingType',"id","source");
          }


          And BuildingType Model should be



          /**
          * Get the Building Image that owns the building type.
          */



          public function buildingImage()
          {
          return $this->belongsTo('AppBuildingImage',"source","id");
          }


          This should work.
          For more info have a look
          https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






          share|improve this answer































            3
















            That's because by default laravel will look for a primary key named {model}_id, and given that you are using a different column name (source), you need to specify when defining the relationship:



            As the documentation states:




            Eloquent determines the foreign key of the relationship based on the model name. In this case, the Phone model is automatically assumed to have a user_id foreign key. If you wish to override this convention, you may pass a second argument to the hasOne method:



            return $this->hasOne('AppPhone', 'foreign_key');


            Additionally, Eloquent assumes that the foreign key should have a value matching the id (or the custom $primaryKey) column of the parent. In other words, Eloquent will look for the value of the user's id column in the user_id column of the Phone record. If you would like the relationship to use a value other than id, you may pass a third argument to the hasOne method specifying your custom key:



            return $this->hasOne('AppPhone', 'foreign_key', 'local_key');





            Now that that is clear. Let's talk about the relationship itself.



            You are defining that a BuildImage has one BuildingType. But with that logic, the foreign key should be stored in the building_types table, and not the other way around (source column appears in the building_images table). And -I'm just assuming that- many BuildImage can belongs to an specific BuildingType. So, if this assumption is correct:




            • a BuildImage belongs to a specific BuildingType.

            • a BuildinType can be specify in many BuildImages


            So, you should define your relationship like this:



            BuildImage.php



            public function type()
            {
            return $this->belongsTo('AppBuildingType', 'source');
            }


            BuildingType.php



            public function images()
            {
            return $this->hasMany(BuildingImage::class, 'source');
            }





            share|improve this answer


























            • So I have to fill in "source" in the "foreign_key" in your code example?

              – Michael
              Nov 15 '18 at 15:20











            • @Michael I'll update. But I thing that you should define your relationship a little bit different.

              – HCK
              Nov 15 '18 at 15:23











            • You can also use the class instead of a string, which some (myself included) tend to prefer. return $this->hasOne(AppPhone::class, 'foreign_key', 'local_key');

              – John Halsey
              Nov 15 '18 at 15:28











            • @JohnHalsey yes, indeed. Nice observation, I'll include it.

              – HCK
              Nov 15 '18 at 15:39



















            0














            Have you tried to indicate the index ID like this?



            public function buildingImage()
            {
            return $this->belongsTo('AppBuildingImage', 'image_request_id');
            }



            Eloquent determines the foreign key of the relationship based on the
            model name. In this case, the Phone model is automatically assumed to
            have a user_id foreign key. If you wish to override this convention,
            you may pass the second argument to the hasOne method:




            return $this->hasOne('AppPhone', 'foreign_key');


            https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






            share|improve this answer


























            • Yes, same error

              – Michael
              Nov 15 '18 at 15:22











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322506%2flaravel-5-6-onetoone-relation-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Your BuildImage model should be



            /**
            * Get the source type of the Building Image.
            */



            public function type() {
            return $this->hasOne('AppBuildingType',"id","source");
            }


            And BuildingType Model should be



            /**
            * Get the Building Image that owns the building type.
            */



            public function buildingImage()
            {
            return $this->belongsTo('AppBuildingImage',"source","id");
            }


            This should work.
            For more info have a look
            https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






            share|improve this answer




























              1














              Your BuildImage model should be



              /**
              * Get the source type of the Building Image.
              */



              public function type() {
              return $this->hasOne('AppBuildingType',"id","source");
              }


              And BuildingType Model should be



              /**
              * Get the Building Image that owns the building type.
              */



              public function buildingImage()
              {
              return $this->belongsTo('AppBuildingImage',"source","id");
              }


              This should work.
              For more info have a look
              https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






              share|improve this answer


























                1












                1








                1







                Your BuildImage model should be



                /**
                * Get the source type of the Building Image.
                */



                public function type() {
                return $this->hasOne('AppBuildingType',"id","source");
                }


                And BuildingType Model should be



                /**
                * Get the Building Image that owns the building type.
                */



                public function buildingImage()
                {
                return $this->belongsTo('AppBuildingImage',"source","id");
                }


                This should work.
                For more info have a look
                https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






                share|improve this answer













                Your BuildImage model should be



                /**
                * Get the source type of the Building Image.
                */



                public function type() {
                return $this->hasOne('AppBuildingType',"id","source");
                }


                And BuildingType Model should be



                /**
                * Get the Building Image that owns the building type.
                */



                public function buildingImage()
                {
                return $this->belongsTo('AppBuildingImage',"source","id");
                }


                This should work.
                For more info have a look
                https://laravel.com/docs/5.7/eloquent-relationships#one-to-one







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 15 '18 at 15:26









                Web ArtisanWeb Artisan

                1,30531224




                1,30531224

























                    3
















                    That's because by default laravel will look for a primary key named {model}_id, and given that you are using a different column name (source), you need to specify when defining the relationship:



                    As the documentation states:




                    Eloquent determines the foreign key of the relationship based on the model name. In this case, the Phone model is automatically assumed to have a user_id foreign key. If you wish to override this convention, you may pass a second argument to the hasOne method:



                    return $this->hasOne('AppPhone', 'foreign_key');


                    Additionally, Eloquent assumes that the foreign key should have a value matching the id (or the custom $primaryKey) column of the parent. In other words, Eloquent will look for the value of the user's id column in the user_id column of the Phone record. If you would like the relationship to use a value other than id, you may pass a third argument to the hasOne method specifying your custom key:



                    return $this->hasOne('AppPhone', 'foreign_key', 'local_key');





                    Now that that is clear. Let's talk about the relationship itself.



                    You are defining that a BuildImage has one BuildingType. But with that logic, the foreign key should be stored in the building_types table, and not the other way around (source column appears in the building_images table). And -I'm just assuming that- many BuildImage can belongs to an specific BuildingType. So, if this assumption is correct:




                    • a BuildImage belongs to a specific BuildingType.

                    • a BuildinType can be specify in many BuildImages


                    So, you should define your relationship like this:



                    BuildImage.php



                    public function type()
                    {
                    return $this->belongsTo('AppBuildingType', 'source');
                    }


                    BuildingType.php



                    public function images()
                    {
                    return $this->hasMany(BuildingImage::class, 'source');
                    }





                    share|improve this answer


























                    • So I have to fill in "source" in the "foreign_key" in your code example?

                      – Michael
                      Nov 15 '18 at 15:20











                    • @Michael I'll update. But I thing that you should define your relationship a little bit different.

                      – HCK
                      Nov 15 '18 at 15:23











                    • You can also use the class instead of a string, which some (myself included) tend to prefer. return $this->hasOne(AppPhone::class, 'foreign_key', 'local_key');

                      – John Halsey
                      Nov 15 '18 at 15:28











                    • @JohnHalsey yes, indeed. Nice observation, I'll include it.

                      – HCK
                      Nov 15 '18 at 15:39
















                    3
















                    That's because by default laravel will look for a primary key named {model}_id, and given that you are using a different column name (source), you need to specify when defining the relationship:



                    As the documentation states:




                    Eloquent determines the foreign key of the relationship based on the model name. In this case, the Phone model is automatically assumed to have a user_id foreign key. If you wish to override this convention, you may pass a second argument to the hasOne method:



                    return $this->hasOne('AppPhone', 'foreign_key');


                    Additionally, Eloquent assumes that the foreign key should have a value matching the id (or the custom $primaryKey) column of the parent. In other words, Eloquent will look for the value of the user's id column in the user_id column of the Phone record. If you would like the relationship to use a value other than id, you may pass a third argument to the hasOne method specifying your custom key:



                    return $this->hasOne('AppPhone', 'foreign_key', 'local_key');





                    Now that that is clear. Let's talk about the relationship itself.



                    You are defining that a BuildImage has one BuildingType. But with that logic, the foreign key should be stored in the building_types table, and not the other way around (source column appears in the building_images table). And -I'm just assuming that- many BuildImage can belongs to an specific BuildingType. So, if this assumption is correct:




                    • a BuildImage belongs to a specific BuildingType.

                    • a BuildinType can be specify in many BuildImages


                    So, you should define your relationship like this:



                    BuildImage.php



                    public function type()
                    {
                    return $this->belongsTo('AppBuildingType', 'source');
                    }


                    BuildingType.php



                    public function images()
                    {
                    return $this->hasMany(BuildingImage::class, 'source');
                    }





                    share|improve this answer


























                    • So I have to fill in "source" in the "foreign_key" in your code example?

                      – Michael
                      Nov 15 '18 at 15:20











                    • @Michael I'll update. But I thing that you should define your relationship a little bit different.

                      – HCK
                      Nov 15 '18 at 15:23











                    • You can also use the class instead of a string, which some (myself included) tend to prefer. return $this->hasOne(AppPhone::class, 'foreign_key', 'local_key');

                      – John Halsey
                      Nov 15 '18 at 15:28











                    • @JohnHalsey yes, indeed. Nice observation, I'll include it.

                      – HCK
                      Nov 15 '18 at 15:39














                    3












                    3








                    3









                    That's because by default laravel will look for a primary key named {model}_id, and given that you are using a different column name (source), you need to specify when defining the relationship:



                    As the documentation states:




                    Eloquent determines the foreign key of the relationship based on the model name. In this case, the Phone model is automatically assumed to have a user_id foreign key. If you wish to override this convention, you may pass a second argument to the hasOne method:



                    return $this->hasOne('AppPhone', 'foreign_key');


                    Additionally, Eloquent assumes that the foreign key should have a value matching the id (or the custom $primaryKey) column of the parent. In other words, Eloquent will look for the value of the user's id column in the user_id column of the Phone record. If you would like the relationship to use a value other than id, you may pass a third argument to the hasOne method specifying your custom key:



                    return $this->hasOne('AppPhone', 'foreign_key', 'local_key');





                    Now that that is clear. Let's talk about the relationship itself.



                    You are defining that a BuildImage has one BuildingType. But with that logic, the foreign key should be stored in the building_types table, and not the other way around (source column appears in the building_images table). And -I'm just assuming that- many BuildImage can belongs to an specific BuildingType. So, if this assumption is correct:




                    • a BuildImage belongs to a specific BuildingType.

                    • a BuildinType can be specify in many BuildImages


                    So, you should define your relationship like this:



                    BuildImage.php



                    public function type()
                    {
                    return $this->belongsTo('AppBuildingType', 'source');
                    }


                    BuildingType.php



                    public function images()
                    {
                    return $this->hasMany(BuildingImage::class, 'source');
                    }





                    share|improve this answer

















                    That's because by default laravel will look for a primary key named {model}_id, and given that you are using a different column name (source), you need to specify when defining the relationship:



                    As the documentation states:




                    Eloquent determines the foreign key of the relationship based on the model name. In this case, the Phone model is automatically assumed to have a user_id foreign key. If you wish to override this convention, you may pass a second argument to the hasOne method:



                    return $this->hasOne('AppPhone', 'foreign_key');


                    Additionally, Eloquent assumes that the foreign key should have a value matching the id (or the custom $primaryKey) column of the parent. In other words, Eloquent will look for the value of the user's id column in the user_id column of the Phone record. If you would like the relationship to use a value other than id, you may pass a third argument to the hasOne method specifying your custom key:



                    return $this->hasOne('AppPhone', 'foreign_key', 'local_key');





                    Now that that is clear. Let's talk about the relationship itself.



                    You are defining that a BuildImage has one BuildingType. But with that logic, the foreign key should be stored in the building_types table, and not the other way around (source column appears in the building_images table). And -I'm just assuming that- many BuildImage can belongs to an specific BuildingType. So, if this assumption is correct:




                    • a BuildImage belongs to a specific BuildingType.

                    • a BuildinType can be specify in many BuildImages


                    So, you should define your relationship like this:



                    BuildImage.php



                    public function type()
                    {
                    return $this->belongsTo('AppBuildingType', 'source');
                    }


                    BuildingType.php



                    public function images()
                    {
                    return $this->hasMany(BuildingImage::class, 'source');
                    }






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 15 '18 at 15:45

























                    answered Nov 15 '18 at 15:19









                    HCKHCK

                    3,57211138




                    3,57211138













                    • So I have to fill in "source" in the "foreign_key" in your code example?

                      – Michael
                      Nov 15 '18 at 15:20











                    • @Michael I'll update. But I thing that you should define your relationship a little bit different.

                      – HCK
                      Nov 15 '18 at 15:23











                    • You can also use the class instead of a string, which some (myself included) tend to prefer. return $this->hasOne(AppPhone::class, 'foreign_key', 'local_key');

                      – John Halsey
                      Nov 15 '18 at 15:28











                    • @JohnHalsey yes, indeed. Nice observation, I'll include it.

                      – HCK
                      Nov 15 '18 at 15:39



















                    • So I have to fill in "source" in the "foreign_key" in your code example?

                      – Michael
                      Nov 15 '18 at 15:20











                    • @Michael I'll update. But I thing that you should define your relationship a little bit different.

                      – HCK
                      Nov 15 '18 at 15:23











                    • You can also use the class instead of a string, which some (myself included) tend to prefer. return $this->hasOne(AppPhone::class, 'foreign_key', 'local_key');

                      – John Halsey
                      Nov 15 '18 at 15:28











                    • @JohnHalsey yes, indeed. Nice observation, I'll include it.

                      – HCK
                      Nov 15 '18 at 15:39

















                    So I have to fill in "source" in the "foreign_key" in your code example?

                    – Michael
                    Nov 15 '18 at 15:20





                    So I have to fill in "source" in the "foreign_key" in your code example?

                    – Michael
                    Nov 15 '18 at 15:20













                    @Michael I'll update. But I thing that you should define your relationship a little bit different.

                    – HCK
                    Nov 15 '18 at 15:23





                    @Michael I'll update. But I thing that you should define your relationship a little bit different.

                    – HCK
                    Nov 15 '18 at 15:23













                    You can also use the class instead of a string, which some (myself included) tend to prefer. return $this->hasOne(AppPhone::class, 'foreign_key', 'local_key');

                    – John Halsey
                    Nov 15 '18 at 15:28





                    You can also use the class instead of a string, which some (myself included) tend to prefer. return $this->hasOne(AppPhone::class, 'foreign_key', 'local_key');

                    – John Halsey
                    Nov 15 '18 at 15:28













                    @JohnHalsey yes, indeed. Nice observation, I'll include it.

                    – HCK
                    Nov 15 '18 at 15:39





                    @JohnHalsey yes, indeed. Nice observation, I'll include it.

                    – HCK
                    Nov 15 '18 at 15:39











                    0














                    Have you tried to indicate the index ID like this?



                    public function buildingImage()
                    {
                    return $this->belongsTo('AppBuildingImage', 'image_request_id');
                    }



                    Eloquent determines the foreign key of the relationship based on the
                    model name. In this case, the Phone model is automatically assumed to
                    have a user_id foreign key. If you wish to override this convention,
                    you may pass the second argument to the hasOne method:




                    return $this->hasOne('AppPhone', 'foreign_key');


                    https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






                    share|improve this answer


























                    • Yes, same error

                      – Michael
                      Nov 15 '18 at 15:22
















                    0














                    Have you tried to indicate the index ID like this?



                    public function buildingImage()
                    {
                    return $this->belongsTo('AppBuildingImage', 'image_request_id');
                    }



                    Eloquent determines the foreign key of the relationship based on the
                    model name. In this case, the Phone model is automatically assumed to
                    have a user_id foreign key. If you wish to override this convention,
                    you may pass the second argument to the hasOne method:




                    return $this->hasOne('AppPhone', 'foreign_key');


                    https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






                    share|improve this answer


























                    • Yes, same error

                      – Michael
                      Nov 15 '18 at 15:22














                    0












                    0








                    0







                    Have you tried to indicate the index ID like this?



                    public function buildingImage()
                    {
                    return $this->belongsTo('AppBuildingImage', 'image_request_id');
                    }



                    Eloquent determines the foreign key of the relationship based on the
                    model name. In this case, the Phone model is automatically assumed to
                    have a user_id foreign key. If you wish to override this convention,
                    you may pass the second argument to the hasOne method:




                    return $this->hasOne('AppPhone', 'foreign_key');


                    https://laravel.com/docs/5.7/eloquent-relationships#one-to-one






                    share|improve this answer















                    Have you tried to indicate the index ID like this?



                    public function buildingImage()
                    {
                    return $this->belongsTo('AppBuildingImage', 'image_request_id');
                    }



                    Eloquent determines the foreign key of the relationship based on the
                    model name. In this case, the Phone model is automatically assumed to
                    have a user_id foreign key. If you wish to override this convention,
                    you may pass the second argument to the hasOne method:




                    return $this->hasOne('AppPhone', 'foreign_key');


                    https://laravel.com/docs/5.7/eloquent-relationships#one-to-one







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 15 '18 at 15:22

























                    answered Nov 15 '18 at 15:21









                    DeimosDeimos

                    134415




                    134415













                    • Yes, same error

                      – Michael
                      Nov 15 '18 at 15:22



















                    • Yes, same error

                      – Michael
                      Nov 15 '18 at 15:22

















                    Yes, same error

                    – Michael
                    Nov 15 '18 at 15:22





                    Yes, same error

                    – Michael
                    Nov 15 '18 at 15:22


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53322506%2flaravel-5-6-onetoone-relation-not-working%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Bressuire

                    Vorschmack

                    Quarantine