title: In laravel how to get the join table data in same array without where condition
body: <p>I have created both employes and employes_detail tabel with the data </p>
  
  <blockquote>
    <p>i have created model for both of the table that is given below:</p>
  </blockquote>
  
  <pre><code>emloye model:
  
  &lt;?php
  
  namespace App\Http\Model;
  
  use Illuminate\Database\Eloquent\Model;
  use App\Http\Model\EmployeDetail;
  class Employe extends Model
  {
      public function employes_detail()
      {
          return $this-&gt;hasOne(EmployeDetail::class);
      }
  }
  </code></pre>
  
  <p>and eployedetail model:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Model;
  
  use Illuminate\Database\Eloquent\Model;
  
  class EmployeDetail extends Model
  {
     public function employe()
      {
          public function employe()
      {
          return $this-&gt;belongsTo(Employe::class);
      }
      }
  }
  </code></pre>
  
  <p>and in controller i used like :
      
  
  <pre><code>namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use DB;
  use App\Http\Model\Employe;
  use App\Http\Model\EmployeDetail;
  class EmployeController extends Controller
  {
      public function index(Request $request)
      {
          $Employe=Employe::all();
          $convert=$Employe-&gt;toArray();
          echo "&lt;pre&gt;";print_r($convert);exit;
          //return view('employe.employe');
      }
  }
  </code></pre>
  
  <blockquote>
    <p>it showing only employe table data how can i show the data for the
    employes_detail as well as .still i am not able to understand it on
    laravel documentation can anyone please help me related this.
        how can i get the all data from employes and employes_details table for all the records</p>
  </blockquote>
  
  <p>but when i used this code in controller:</p>
  
  <pre><code>public function index(Request $request)
      {
          $Employe=Employe::where('id',1)-&gt;first();
          //$convert=$Employe-&gt;toArray();
          echo "&lt;pre&gt;";print_r($Employe-&gt;employes_detail);exit;
          //return view('employe.employe');
      }
  </code></pre>
  
  <blockquote>
    <p>its shows me the employe_detail table data
        but i want both of the table data in a same array and i dont want to use where condition here.</p>
  </blockquote>