DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

1

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)

Image of Stellar post

🚀 Stellar Dev Diaries Series: Episode 1 is LIVE!

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay