我正在使用最新的Laravel安装。雄辩 - 不等于
我的表结构是这样的:https://www.uploady.com/#!/download/OQSH4ualzUD/x2SIqdcaulqzSSsy
我想这些查询:
Code::where('to_be_used_by_user_id', '<>' , 2)->get()
Code::whereNotIn('to_be_used_by_user_id', [2])->get()
Code::where('to_be_used_by_user_id', 'NOT IN', 2)->get()
理想的情况下,它应该回到过去的3条记录。但它返回空白数组。我如何解决这个问题?请帮忙。
Code::all()
返回所有4条记录。
代码模型:
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Code extends Model
{
protected $fillable = ['value', 'registration_id', 'generated_for_user_id', 'to_be_used_by_user_id', 'code_type_id', 'is_used'];
public function code_type()
{
return $this->belongsTo('App\CodeType');
}
}
请解释downvote。我会纠正这个问题。 – aBhijit 2015-01-31 21:54:17