title: SQLSTATE[42S22]: Column not found: 1054 Unknown column - Laravel
body: <p>I'm using the framework Laravel.</p>
  
  <p>I have 2 tables (Users and Members). When I want to login, I get the error message:</p>
  
  <blockquote>
    <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user_email' in
    'where clause' (SQL: select * from <code>members</code> where <code>user_email</code> = ?
    limit 1) (Bindings: array ( 0 => 'test@hotmail.com', ))</p>
  </blockquote>
  
  <p>Table Users</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `festival_aid`.`users` (
    `user_id` BIGINT NOT NULL AUTO_INCREMENT,
    `user_email` VARCHAR(45) NOT NULL,
    `user_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `user_modified` TIMESTAMP NULL,
    `user_deleted` TIMESTAMP NULL,
    `user_lastlogin` TIMESTAMP NULL,
    `user_locked` TIMESTAMP NULL,
    PRIMARY KEY (`user_id`),
    UNIQUE INDEX `user_email_UNIQUE` (`user_email` ASC),
  ENGINE = InnoDB;
  </code></pre>
  
  <p>Table Members</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `festival_aid`.`members` (
    `member_id` BIGINT NOT NULL AUTO_INCREMENT,
    `member_password` CHAR(32) NOT NULL,
    `member_salt` CHAR(22) NOT NULL,
    `member_token` VARCHAR(128) NULL,
    `member_confirmed` TIMESTAMP NULL,
    `user_id` BIGINT NOT NULL,
    PRIMARY KEY (`member_id`, `user_id`),
    INDEX `fk_members_users1_idx` (`user_id` ASC),
    CONSTRAINT `fk_members_users1`
      FOREIGN KEY (`user_id`)
      REFERENCES `festival_aid`.`users` (`user_id`)
      ON DELETE NO ACTION
      ON UPDATE NO ACTION)
  ENGINE = InnoDB;
  </code></pre>
  
  <p>Migration User</p>
  
  <pre><code>public function up()
      {
          Schema::table('users', function(Blueprint $table)
          {
              $table-&gt;increments('user_id');
  
              $table-&gt;string('user_email');
              $table-&gt;timestamp('user_created');
              $table-&gt;timestamp('user_modified');
              $table-&gt;timestamp('user_deleted');
              $table-&gt;timestamp('user_lastlogin');
              $table-&gt;timestamp('user_locked');
          });
      }
  </code></pre>
  
  <p>Migration Member</p>
  
  <pre><code>public function up()
      {
          Schema::table('members', function(Blueprint $table)
          {
              $table-&gt;increments('member_id');
  
              $table-&gt;string('member_password');
              $table-&gt;string('member_salt');
              $table-&gt;string('member_token');
  
              $table-&gt;foreign('user_id')
                  -&gt;references('id')-&gt;on('users');
              //-&gt;onDelete('cascade');
  
              $table-&gt;timestamp('member_confirmed');
          });
      }
  </code></pre>
  
  <p>Model User</p>
  
  <pre><code>class User extends Eloquent {
  
      protected $table = 'users';
  
      /**
       * The primary key for the model.
       *
       * @var string
       */
      protected $primaryKey = 'user_id';
  
      public $timestamps = false;
  }
  </code></pre>
  
  <p>Model Member</p>
  
  <pre><code>use Illuminate\Auth\UserInterface;
  use Illuminate\Auth\Reminders\RemindableInterface;
  
  class Member extends Eloquent implements UserInterface, RemindableInterface {
  
      protected $table = 'members';
  
      /**
       * The attributes excluded from the model's JSON form.
       *
       * @var array
       */
      protected $hidden = array('member_password');
  
      /**
       * Get the unique identifier for the user.
       *
       * @return mixed
       */
      public function getAuthIdentifier()
      {
          return $this-&gt;getKey();
      }
  
      /**
       * Get the password for the user.
       *
       * @return string
       */
      public function getAuthPassword()
      {
          return $this-&gt;member_password;
      }
  
      /**
       * Get the e-mail address where password reminders are sent.
       *
       * @return string
       */
      public function getReminderEmail()
      {
          return $this-&gt;email;
      }
  
      /**
       * The primary key for the model.
       *
       * @var string
       */
      protected $primaryKey = 'member_id';
  
      public $timestamps = false;
  
      public function users()
      {
          return $this-&gt;hasOne('User');
      }
  }
  </code></pre>
  
  <p>The Member model uses:
  use Illuminate\Auth\UserInterface;</p>
  
  <pre><code>&lt;?php namespace Illuminate\Auth;
  
  interface UserInterface {
  
      /**
       * Get the unique identifier for the user.
       *
       * @return mixed
       */
      public function getAuthIdentifier();
  
      /**
       * Get the password for the user.
       *
       * @return string
       */
      public function getAuthPassword();
  
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public function store()
      {
          $input = Input::all();
  
          $rules = array('user_email' =&gt; 'required', 'member_password' =&gt; 'required');
  
          $v = Validator::make($input, $rules);
  
          if($v-&gt;passes())
          {
              $credentials = array('user_email' =&gt; $input['user_email'], 'member_password' =&gt; $input['member_password']);
  
              if(Auth::attempt($credentials))
              {
                  return Redirect::to('/home');
  
              } else {
  
                  return Redirect::to('login');
              }
  
          } else {
  
              return Redirect::to('login')-&gt;withErrors($v);
          }
      }
  </code></pre>
  
  <p>auth.php</p>
  
  <p>
  
  <pre><code>return array(
  
      /*
      |--------------------------------------------------------------------------
      | Default Authentication Driver
      |--------------------------------------------------------------------------
      |
      | This option controls the authentication driver that will be utilized.
      | This drivers manages the retrieval and authentication of the users
      | attempting to get access to protected areas of your application.
      |
      | Supported: "database", "eloquent"
      |
      */
  
      'driver' =&gt; 'eloquent',
  
      /*
      |--------------------------------------------------------------------------
      | Authentication Model
      |--------------------------------------------------------------------------
      |
      | When using the "Eloquent" authentication driver, we need to know which
      | Eloquent model should be used to retrieve your users. Of course, it
      | is often just the "User" model but you may use whatever you like.
      |
      */
  
      'model' =&gt; 'Member',
  
      /*
      |--------------------------------------------------------------------------
      | Authentication Table
      |--------------------------------------------------------------------------
      |
      | When using the "Database" authentication driver, we need to know which
      | table should be used to retrieve your users. We have chosen a basic
      | default value but you may easily change it to any table you like.
      |
      */
  
      'table' =&gt; 'members',
  
      /*
      |--------------------------------------------------------------------------
      | Password Reminder Settings
      |--------------------------------------------------------------------------
      |
      | Here you may set the settings for password reminders, including a view
      | that should be used as your password reminder e-mail. You will also
      | be able to set the name of the table that holds the reset tokens.
      |
      | The "expire" time is the number of minutes that the reminder should be
      | considered valid. This security feature keeps tokens short-lived so
      | they have less time to be guessed. You may change this as needed.
      |
      */
  
      'reminder' =&gt; array(
  
          'email' =&gt; 'emails.auth.reminder',
  
          'table' =&gt; 'password_reminders',
  
          'expire' =&gt; 60,
  
      ),
  
  );
  </code></pre>
  
  <p>What am I doing wrong here? </p>