title: How to set a value in join() rather a column name in Eloquent?
body: <p>Here is my schemes：</p>
  
  <h2>user_familiarity</h2>
  
  <p><code>id, item_type, item_id, score, custom_score , ...</code></p>
  
  <h2>word</h2>
  
  <p><code>id , ...</code></p>
  
  <p>user_familiarity stores familiarity score of any object, which can identified by (item_type, item_id)</p>
  
  <p>for example: </p>
  
  <p>item_type = 1001, item_id = 16 means table <code>word</code> and row's id is 16</p>
  
  <p>Here is my code to select words with it's familiarity score:</p>
  
  <pre><code>$fam_table = UserFamiliarityModel::getTableName();
      return
          $query
          -&gt;leftJoin($fam_table, function ($join) use($fam_table) {
              $join
              -&gt;on(WordModel::getTableName() . '.id' ,'=',  "${fam_table}.item_id")
              -&gt;on($fam_table . '.item_type' ,  1001);
          })
          -&gt;addSelect(["${fam_table}.score", "${fam_table}.custom_score"]);
  </code></pre>
  
  <p>here is the sql that has been executed:</p>
  
  <pre><code>...
  FROM
  `word`
  LEFT JOIN `user_familiarity` 
  ON 
      `word`.`id` = `user_familiarity`.`item_id` 
  AND `user_familiarity`.`item_type` = `1001`
  </code></pre>
  
  <p>and get errors :</p>
  
  <blockquote>
    <p>Column not found: 1054 Unknown column '1001' </p>
  </blockquote>