DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

How I can avoid using `array_map` on my results returning primary keys in Laravel's 5.7 database layer?

I have the following table named mytable:

id SERIAL PK
namae VARCHAR

And using laravel 5.7 I need to retrieve the data using the following code (tested in a tinker session):

$yakuzaNames = DB::select('SELECT id from mytable where name like 'omaewa%')
dump($yakuzaNames);

The problem is that once data retrieved…

Top comments (0)