title: Laravel 8: how to retrieve data of a one to one relationship in existing database?
body: <p>I am having some problems retrieving data in a one-to-one relationship.
  I have this existing Table and I want to retrieve the data from rfp_details.
  here is my code</p>
  <pre><code>//rfpmain model
  protected $table = 'accounting.request_for_payment';
  public function rfpDetail(){
      return $this-&gt;hasOne(RfpDetail::class);
  }
  
  
  //rfp detail model
  protected $table = 'accounting.rfp_details';
  public function rfpMain(){
      return $this-&gt;belongsTo(RfpMain::class);
  }
  
  //rfp controller
  public function show($id)
  {
      $rfpMain = RfpMain::findOrFail($id);
      $rd = $rfpMain-&gt;rfpDetails;
      dd($rd);
  }
  </code></pre>
  <p>below is the structure of my existing database</p>
  <p><a href="https://i.stack.imgur.com/WZZwx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WZZwx.png" alt="enter image description here" /></a></p>