I have this select where I want to get id count:
$x = DB::select(' select count(id)
from repairs
where vehicle_id = ?',
[$vehicle->id]);
But I am not sure if I am getting in my variable $x just a simple int number or some string type, because I want to use this $x variable in
if($x>0){
do something
}
And I always get non zero value, even though I should get zero. What is wrong?
i think your select not returning a scale value. and because i don't know your ORM i just can tell you try if(count($x)>0)