title: How to make relation of users table and other with none primary key on Laravel
body: <p>I have users table assigned a foreign key(clinic_uuid, not primary key) to clinics table as below command.</p>
  
  <pre><code>$table-&gt;foreign('clinic_uuid',100)-&gt;references('clinic_uuid')-&gt;on('clinics');
  </code></pre>
  
  <p>After migration, I added 'hasmany users' relation to Clinic model.</p>
  
  <pre><code>public function users(){
   return $this-&gt;hasMany(User::class);
  }
  </code></pre>
  
  <p>And also 'belongsTo Clinic' relation to User model</p>
  
  <pre><code>public function clinic(){
     return $this-&gt;belongsTo(Clinic::class,'clinic_uuid');
  }
  </code></pre>
  
  <p>After that I add a few to clinics table.</p>
  
  <pre><code>    clinic_uuid       name
  ----------------------------------
         a1111       dog clinic
         a2222       cat clinic
  </code></pre>
  
  <p>And also users table.</p>
  
  <pre><code>  id    clinic_uuid       name
  ----------------------------------
    1       a1111           jame
    2       a1111           matt
  </code></pre>
  
  <p>Then, I try on my controller as below code but I get only null.</p>
  
  <pre><code>Auth::user()-&gt;clinic()-&gt;get();   --&gt; get null
  User::find(1)-&gt;clinic()-&gt;get();  --&gt; get null
  </code></pre>
  
  <p>Appreciated for all advise.</p>