DB Query Builder

DB Query Builder
Description
Allows OpenCart code to use Eloquent/Query Builder methods to work with database tables instead of ‘raw’ SQL queries.

Version support
OpenCart 2/3: OCMOD modifier corrects catalog/controller/startup/startup.php and admin/controller/startup/startup.php.
OpenCart 4: register startup in module install() method, without core edits.

Requirements
PDO extension for MySQL (pdo_mysql)

Usage
In the file system/library/eloquent.php, the QB class
class QB extends \Illuminate\Database\Capsule\Manager {}

The QB class is available immediately:
// via the facade
$users = QB::table('user')->get();

The capsule instance is also stored in the registry:
$this->registry->set('eloquent', EloquentDB::getCapsule());
// and in controllers
$qb = $this->eloquent;
$orders = $qb->table('order')->where('status',1)->get();

More information can be found in the official laravel documentation https://laravel.com/docs/12.x/queries




Download
  • Developed by OpenCart Community
  • Documentation Included

Rating

Compatibility
4.x.x.x, 4.0.0.0, 4.0.1.0, 4.0.1.1, 4.0.2.0, 4.0.2.1, 4.0.2.2, 4.0.2.3, 4.1.0.0, 4.1.0.1, 4.1.0.2, 4.1.0.3, 3.0.0.0, 3.0.1.0, 3.0.1.1, 3.0.1.2, 3.0.1.3, 3.0.2.0, 3.0.3.0, 3.0.3.1, 3.0.3.2, 3.0.3.3, 3.0.3.5, 3.0.3.6, 3.0.3.7, 3.0.3.8, 3.x.x.x, 3.0.3.9, 3.0.4.0, 2.2.0.0, 2.3.0.0, 2.3.0.1, 2.3.0.2, 2.1.0.1, 2.1.0.2

Last Update
19 May 2025

Created
14 May 2025
33 Downloads
0 Comments
alex93x
alex93x
Member since: 22 Feb 2018

View all extensions Get Support