Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

What win32 application? Can you show the table structures and table names?

0

It is a win32 application from a friend. I develop a small web application which is able to show the data with some nice graphics and stuff. The table is called "bookings" and has some basic columns like 'id', 'productcode' and the 'productname'. A booking is ´basically an action like selling something.

Imagine this structure:

http://laravel.io/bin/Oe9J2

Now I want to retrieve all products ('PRODUCTNAME') and count which off them is selled the most.

Last updated 9 years ago.
0

I'm not 100% sure, but I believe you need a model. But could you use a combination of grouping and then paginate only 10 for the results.
Some code from the docs:

$users = DB::table('users')
                    ->orderBy('name', 'desc')
                    ->groupBy('count')
                    ->having('count', '>', 100)
                    ->get();

And learn how to use the skip and take in query builder.

$users = DB::table('users')->skip(0)->take(10)->get();

Read over the query builder docs. Also see if this helps:
http://laravel.io/forum/04-04-2015-looping-through-collection

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

LukasMa lukasma Joined 26 Nov 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.