title: In laravel relationships between two models
body: <p>i want to create relation between two table Studentapplyinfo and user but one primarykey  data in uppercase and second is exist in lowercase and how to relate relation in laravel  </p>
  
  <pre><code>public function students()
      {
          return $this-&gt;hasOne('App\Models\StudentsApplyInfo', 'sai_enrollment_no', 'username');
      }
  </code></pre>
  
  <p>i'm tried to this but not working </p>
  
  <pre><code> public function studentsapplyinfo()
      {
          $relation = $this-&gt;belongsToMany('App\Models\StudentsApplyInfo');
  
          $relation
  
              -&gt;getQuery() // Eloquent\Builder
              -&gt;getQuery() // Query\Builder
              -&gt;joins = [];
  
          $relation-&gt;getQuery()
              -&gt;join('students_apply_info', 
  
  'students_apply_info.sai_enrollment_no', '=', 'sisusers.username');
  
  
          return $relation;
      }
  </code></pre>