Support the ongoing development of Laravel.io →
Database Laravel
Last updated by @tvbeek 2 weeks ago.
0
moderator Solution

Hello @shazam7734

I think it can be helpful to read the documentation about the query builder for more information.

I think this is what you want to have:

$surveys = DB::table('surveys')
    -->select('name', 'value')
    ->where('user_id', $user_id)
    ->orderBy('updated_at', 'DESC')
    -->limit(13)
    ->get();
return view('home',['surveys'=>$surveys]);

PS. I have updated your post to make the codeblocks more readable.

0
Solution selected by @shazam7734

Thank you so much @tvbeek, that did the trick! I am curious how to create code blocks for making my code more readable :)

0

@shazam7734 I'm not sure if you can edit your first post to see the change.

But the difference is to use three ` and not one. A single one is for inline code and the use of three is for a block of code and also result in highlighting of the code.

I also place them on a separated line (before and after the code)

1

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Sarah Sarah shazam7734 Joined 25 Jul 2022

Moderators

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

Your logo here?

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

© 2022 Laravel.io - All rights reserved.