To reproduce, define some validation rules that use the "unique" rule:
$rules = array(
'username' => 'required|min:5|unique:users,username,123',
);
$validation = Validator::make(Input::all(),$rules);
if($validation->passes()) {
return 'Ok.';
}
The rule fails to generate the proper query if the referenced table does not rely on a primary key named "id". E.g. if your table is defined using a primary key of "user_id", the query and validation rule fails
Schema::create('users', function(Blueprint $table) {
$table->increments('user_id')->unsigned();
// ... etc...
Even if the model includes
protected $primaryKey = 'user_id';
Laravel version 4.1.23