I have a query like this:
$query = "Select EXISTS(SELECT * FROM grp_user AS pivot JOIN groups
AS g ON pivot.grp_id = g.id JOIN vote ON g.id = vote.grp_id WHERE
pivot.grp_id = :grp_id AND pivot.user_id = :user_id)";
and I want to run it . so I tried:
$res = DB::select($query,array("grp_id"=>250,"user_id"=>1));
res ideally should have a boolean value, but instead it has an array like :
[{"EXISTS(SELECT * FROM grp_user AS pivot JOIN groups AS g ON pivot.grp_id = g.id JOIN vote ON g.id = vote.grp_id WHERE pivot.grp_id = ? AND pivot.user_id = ?)":1}]
Note the 1 at the end, that is the value I'm interested in (its either 1 or 0).
How can I make this work , or achieve this the 'laravel' way ?