Sto usando l'ultima installazione di Laravel.Eloquent - dove non uguale a
La mia struttura della tabella è questo: https://www.uploady.com/#!/download/OQSH4ualzUD/x2SIqdcaulqzSSsy
ho provato queste query:
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()
Idealmente, dovrebbe restituire ultimi 3 record. Ma restituisce matrice vuota. Come posso affrontare questo? Per favore aiuto.
Code::all()
restituisce tutti e 4 i record.
modello Codice:
<?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');
}
}
Si prega di spiegare il downvote. Correggerò la domanda – aBhijit