title: Problem with Eloquent : Undefined function: 7 ERROR: operator does not exist
body: <p>I use <code>postgresql</code> and i have <code>three table</code> </p>
  
  <p>1: <strong>Habilitation</strong></p>
  
  <pre><code>code              - string(225)
  code_menu  - string(225) 
  code_sub_menu  - string(225) 
  name             - string(225)
  </code></pre>
  
  <p>2: <strong>menu</strong></p>
  
  <pre><code>code              - string(225)
  name             - string(225)
  </code></pre>
  
  <p>3: <strong>submenu</strong></p>
  
  <pre><code>code              - string(225)
  name             - string(225)
  </code></pre>
  
  <p>I want to show <strong>habilitations</strong> with their <strong>menu</strong> and <strong>sub-menu</strong> using Eloquent , when i try :</p>
  
  <pre><code>Habilitation::with(['menu','submenu'])-&gt;get();
  </code></pre>
  
  <p>i get this error : </p>
  
  <pre><code>Illuminate\Database\QueryException
  SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: character varying = integer LINE 1: select * from "menu" where "menu"."code" in (0, 0, 0, 0) ^ HINT: No operator matches the given name and argument types. You might need to add explicit type casts. (SQL: select * from "menu" where "menu"."code" in (0, 0, 0, 0)) 
  </code></pre>
  
  <p>My models :</p>
  
  <pre><code>class Menu extends Model
  {
      protected $table = "menu";
      public $primaryKey = "code";
      public $timestamps = false;
  
      protected $casts = [
          'code' =&gt; 'string',
      ];
  
      public function submenu()
      {
          return $this-&gt;hasMany('App\Models\SubMenu','code');
      }
  
      public function habilitation()
      {
          return $this-&gt;hasMany('App\Models\Habilitation','code');
      }
  }
  
  class SubMenu extends Model
  {
      protected $table = "submenu";
      public $primaryKey = "code";
      public $timestamps = false;
  
      protected $casts = [
          'code' =&gt; 'string',
      ];
  
      public function menu()
      {
          return $this-&gt;belongsTo('App\Models\SubMenu','code');
      }
  
      public function habilitation()
      {
          return $this-&gt;hasMany('App\Models\Habilitation','code');
      }
  
  }
  
  class Habilitation extends Model
  {
      protected $table = "habilitation";
      public $primaryKey = "code";
      public $timestamps = false;
  
      protected $fillable = [
          'code', 'code_menu','code_sub_menu'
      ];
  
      protected $casts = [
          'code' =&gt; 'string',
          'code_menu' =&gt; 'string',
          'code_sub_menu' =&gt; 'string'
      ];
  
      public function menu()
      {
          return $this-&gt;belongsTo('App\Models\Menu','code_menu','code');
      }
  
      public function submenu()
      {
          return $this-&gt;belongsTo('App\Models\SubMenu');
      }
  
  }
  </code></pre>
  
  <p>i haven't problem using query builder of laravel but i want to use Eloquent for it.
  someone could help me ? or give me some hints ?<br>
  thank you in advance</p>