Parameter by name in the query

0

I have the following query

SELECT * FROM myTable WHERE ip = 192.168.1.2

I would like to make a query by sending parameter by name using DB::raw()

$dados = DB::raw("SELECT * FROM myTable WHERE ip = :ip", ["ip" => '192.168.1.2'])

Is it possible?

I tried this way but I could not.

I want to do this, because if you have a query that repeats the parameter again I do not have to repeat the variable

    
asked by anonymous 15.11.2018 / 19:01

0 answers