title: SQLSTATE[42S22]: Column not found: 1054 Unknown column with datatables
body: <p>i'm using laravel 5.3</p>
  
  <p>i have 2 tables (users and jadwals), when i want to display table jadwals with datatables i got this error message:</p>
  
  <h2>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'jadwals.users_id' in 'on clause' (SQL: select * from <code>jadwals</code> left join <code>users</code> on <code>jadwals</code>.<code>users_id</code> = <code>users</code>.<code>id</code> order by <code>users</code>.<code>name</code> asc limit 10 offset 0)</h2>
  
  <p>table users</p>
  
  <pre><code>Schema::create('users', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;string('name');
          $table-&gt;bigInteger('nimnip')-&gt;unique();
          $table-&gt;string('email')-&gt;unique();
          $table-&gt;string('password');
          $table-&gt;rememberToken();
          $table-&gt;timestamps();
  </code></pre>
  
  <p>table jadwals</p>
  
  <pre><code>Schema::create('jadwals', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;integer('user_id')-&gt;unsigned();
          $table-&gt;string('kegiatan');
          $table-&gt;integer('ruangan_id')-&gt;unsigned();
          $table-&gt;integer('jam_mulai_id')-&gt;unsigned();
          $table-&gt;integer('jam_selesai_id')-&gt;unsigned();
          $table-&gt;timestamps();
  
          $table-&gt;foreign('user_id')-&gt;references('id')-&gt;on('users')-&gt;onUpdate('cascade')-&gt;onDelete('cascade');
          $table-&gt;foreign('ruangan_id')-&gt;references('id')-&gt;on('ruangans')-&gt;onUpdate('cascade')-&gt;onDelete('cascade');
          $table-&gt;foreign('jam_mulai_id')-&gt;references('id')-&gt;on('jams')-&gt;onUpdate('cascade')-&gt;onDelete('cascade');
          $table-&gt;foreign('jam_selesai_id')-&gt;references('id')-&gt;on('jams')-&gt;onUpdate('cascade')-&gt;onDelete('cascade');
  </code></pre>
  
  <p>model user</p>
  
  <pre><code>/**
   * The attributes that are mass assignable.
   *
   * @var array
   */
  protected $fillable = [
      'name', 'nimnip', 'email', 'password',
  ];
  
  public function jadwals()
  {
      return $this-&gt;hasMany('App\Jadwal');
  }
  
  /**
   * The attributes that should be hidden for arrays.
   *
   * @var array
   */
  protected $hidden = [
      'password', 'remember_token',
  ];
  </code></pre>
  
  <p>model jadwal</p>
  
  <pre><code>public function users()
  {
      return $this-&gt;belongsTo('App\User');
  }
  
  public function ruangans()
  {
      return $this-&gt;belongsTo('App\Ruangan');
  }
  
  public function jams()
  {
      return $this-&gt;belongsTo('App\Jam');
  }
  </code></pre>
  
  <p>JadwalsController</p>
  
  <pre><code>    class JadwalsController extends Controller
  {
      /**
       * Display a listing of the resource.
       *
       * @return \Illuminate\Http\Response
       */
      public function index(Request $request, Builder $htmlBuilder)
      {
          if($request-&gt;ajax())
          {
              $jadwals = Jadwal::with('users', 'ruangans', 'jams');
              return Datatables::of($jadwals)
                  -&gt;addColumn('action', function($jadwal){
                      return view('datatable._action', [
                          'model'             =&gt;  $jadwal,
                          'form_url'          =&gt;  route('jadwals.destroy', $jadwal-&gt;id),
                          'edit_url'          =&gt;  route('jadwals.edit', $jadwal-&gt;id),
                          'confirm_message'   =&gt;  'yakin mau menghapus ' . $jadwal-&gt;kegiatan . '?'
                          ]);
                  })-&gt;make(true);
          }
  
          $html = $htmlBuilder
              -&gt;addColumn(['data' =&gt; 'users.name',        'name' =&gt; 'users.name',         'title' =&gt; 'Nama Peminjam'])
              -&gt;addColumn(['data' =&gt; 'kegiatan',          'name' =&gt; 'kegiatan',           'title' =&gt; 'Kegiatan'])
              -&gt;addColumn(['data' =&gt; 'ruangans.ruangan',  'name' =&gt; 'ruangan.ruangan',   'title' =&gt; 'Ruangan'])
              -&gt;addColumn(['data' =&gt; 'jams.jam',          'name' =&gt; 'jam.jam',           'title' =&gt; 'Jam Mulai'])
              -&gt;addColumn(['data' =&gt; 'jams.jam',          'name' =&gt; 'jam.jam',           'title' =&gt; 'Jam Selesai'])
              -&gt;addColumn(['data' =&gt; 'action', 'name' =&gt; 'action', 'title'=&gt;'', 'orderable'=&gt;false, 'searchable'=&gt;false]);
  
              return view('jadwals.index')-&gt;with(compact('html'));
      }
  </code></pre>
  
  <p>what is the problem here?</p>