Category Archives: Laravel

Laravel Count and GroupBy Field Query

I have been busy developing an e-commerce platform from zero to fulfill this semester project for Web Programming Course.

I need to select 5 the most popular product based on customer order. Customer order is stored in order_details table. To make a that query in laravel, try this:

Based on code snippet above, it will return 5 product_id as the most ordered product.

p/s: my 2016 mission, be a morning person!

Installing Laravel Debugbar For Easy Debugging Laravel 5

The Laravel Debugbar by Barry vd. Heuvel is a package that allows you to quickly and easily keep tabs on your application during development. With a simple installation and powerful features, theDebugbar package is one of the cornerstone packages for Laravel.

debugbar-route

In your Laravel 5 project require the package:

composer require barryvdh/laravel-debugbar

Next open config/app.php and inside the ‘providers’ array add:

Barryvdh\Debugbar\ServiceProvider::class,

If you want to use the facade to log messages, add this to your facades in app.php:

‘Debugbar’ => Barryvdh\Debugbar\Facade::class,

Now as long as your app is in debug mode the bar will already be loading showing some nice stats about the page you are viewing.