PHP code example of loilo / contao-illuminate-database-bundle
1. Go to this page and download the library: Download loilo/contao-illuminate-database-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
loilo / contao-illuminate-database-bundle example snippets
use function Loilo\ContaoIlluminateDatabaseBundle\Database\db;
$row = db()
->select('id', 'name')
->from('user')
->where('admin', '1')
->orderBy('dateAdded')
->first();
$user = db()
->from('user')
->asModel() // <- notice this line
->where('admin', '1')
->orderBy('dateAdded')
->first();
// $user will be an instance of \UserModel
// Set an empty prefix to use the "tl_user" table
db([ 'prefix' => '' ])->from('tl_user')->first();