如何修复'SQLSTATE [42S22]:未找到列:1054'where子句'中的未知列'id'(SQL:select * from`users`其中`id` = 0 limit 1)'

I have edited to default registration form provided by Laravel.

I want to replace the 'id' with 'student_no'.

How can I make the changes in the query? I am not able to find the query since it was automatically generated. The code mentioned below is the code in RegisterController.php.

RegisterController.php

    <?php

    namespace App\Http\Controllers\Auth;

    use App\User;
    use App\Http\Controllers\Controller;
    use Illuminate\Support\Facades\Validator;
    use Illuminate\Foundation\Auth\RegistersUsers;

    class RegisterController extends Controller
    {
        /*
        |--------------------------------------------------------------------------
        | Register Controller
        |-----------------------------------------------------------------------



        use RegistersUsers;



    public function __construct()
        {
            $this->middleware('guest');
        }



    /**
         * Get a validator for an incoming registration request.
         *
         * @param  array  $data
         * @return \Illuminate\Contracts\Validation\Validator
         */


protected function validator(array $data)
    {
        return Validator::make($data, [
            'student_no'=> 'required|unique:users',
            'name' => 'required|string|max:255',
            'CID_No'=> 'required|max:8',
            'DOB'=> 'required',
            'Department'=> 'required',
            'Programme'=> 'required',
            'email' => 'required|string|email|max:255|unique:users',
            //'Joining_Year'=> 'required',
            'graduation_Year'=> 'required',
            'password' => 'required|string|min:6|confirmed',
        ]);
    }



    /**
         * Create a new user instance after a valid registration.
         *
         * @param  array  $data
         * @return \App\User
         */


    protected function create(array $data)
        {
            return User::create([
                'student_no'=> $data['student_no'],
                'name' => $data['name'],
                'CID_No' => $data['CID_No'],
                'DOB' => $data['DOB'],
                'Department' => $data['Department'],
                'Programme' => $data['Programme'],
                'email' => $data['email'],
                'Joining_Year' => $data['Joining_year'],
                'graduation_Year' => $data['graduation_Year'],
                'password' => bcrypt($data['password']),
            ]);
        }
    }

Automatically assumes your primary key column is going to be id. In order for this to work correctly, you should set your primary key in your model User.php :

protected $primaryKey = 'student_no';