Query returns empty when executed in Laravel

Asked

Viewed 132 times

0

I am running the following SQL:

select * from `table` where `fields` = PointFromText("POINT(-23.559762 -46.699425)")

When executed directly by the bank returns the id expected to be executed by Laravel to SQL returns

[]

Code in the Laravel.

$data=Model::whereRaw('field=PointFromText("POINT(?)")',['-23.559762 -46.699425'])->get();

What’s wrong with the code above to return [] instead of id expected?

  • Exchange whereRaw for Where and use DB::raw("Pointfromtext(-23.559762 -46.699425)")

  • is because of the quotation marks ['-23.559762 -46.699425'] !!! among the numbers.

  • I’ve tried without the quotes );

  • @B.A makes a Model::all() and puts it on dd for me to see something

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.