php - Laravel SQLite whereHas queries not working -


i'm using sqlite laravel app , trying run wherehas query:

$payments = payment::wherehas('payers', function($q){     $q->where('user_id', '=', 1);  })->get(); 

this returns empty result , due integer 1 being cast string evidenced resulting query generated laravel/eloquent:

select * "payments" (select count(*) "payers" inner join "payer_payment" on "payers"."id" = "payer_payment"."payer_id" "payer_payment"."payment_id" = "payments"."id" , "user_id" = 1) >= '1' 

having reviewed this github issue tried using db::raw so:

$payments = payment::wherehas('payers', function($q){       $q->where('user_id', '=', db::raw(1));  })->get(); 

but no improvement. how can fix without changing database driver?

$payments = payment::wherehas('payers', function($q){       $q->where('user_id', '=', 1);  }, '>=', db::raw(1))->get(); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -