Support the ongoing development of Laravel.io →
Security Database
Last updated 1 year ago.
0

Whats being returned is all the info on the table, ready for further manipulation. You need to tell the DB you have finished your query and to return the rows, this can be done with either first() or get().

I would also recommend using eloquent rather than just the normal DB, an example of how the above query could be done would be:

$user = User::firstOrFail('2');
dd($user);

Hope this helps

Last updated 1 year ago.
0

@cgoosey

Thanxx buddy a lot for your precious time and help ,ya sure ,its helping. and i will definitely move to eloquent. but just my view is if query is incomplete is should return that error else than returning such a big data which hanged my browser and it got crashed.

Last updated 1 year ago.
0

The data is from you mis-using the object, its not expected to be dumped like that, specific information is mean to be requested. Until you request that specific information it needs to remember all that data to be flexible with (for example) further where statements.

Sometimes its fun to var_dump() (or as I prefer dd() - a function in laravel that dumps and dies) and you can tell a lot of things by doing it. But rarely does it help when playing with the database!

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

sksethi25 sksethi25 Joined 7 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.