laravel - Query with eloquent or Where clause -


this query return me not right values .

everything going till $query->where('valid_licence_id', '1') when add :

->where('statut_licence_id' , '4') ->orwhere('statut_licence_id' , '1');

the query display me result 'valid_licence_id = 3 , not 1 . here i'm doing wrong ? lot in advance

$licencies = licencies::where(['structure_id' => auth::user()->structure->id])             ->where(function ($query) {                 $query->where('valid_licence_id', '1')                 ->where('statut_licence_id' , '4')                 ->orwhere('statut_licence_id' , '1');             })->orderby('created_at', 'desc')->paginate(10);         return view('licencie/notconfirmed', compact('licencies')); 

place this

->where('valid_licence_id', '1') 

out of closure.

->where('valid_licence_id', '1') ->where(function ($query) {     $query->where('statut_licence_id' , '4')     ->orwhere('statut_licence_id' , '1'); })->orderby('created_at', 'desc')->paginate(10); 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -