PHP code example of ybr-nx / laravel-mariadb

1. Go to this page and download the library: Download ybr-nx/laravel-mariadb 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/ */

    

ybr-nx / laravel-mariadb example snippets


'providers' => [
    /*
     * Package Service Providers...
     */
    YbrNX\MariaDB\MariaDBServiceProvider::class,
]

'defaultconnection' => [
    'driver' => 'mariadb',

$table->json('field') //CHECK (JSON_VALID(field))
$table->json('field')->nullable() //CHECK (field IS NULL OR JSON_VALID(field))

$query->where('somejson->something->somethingelse', 2)
DB::table('sometable')->select('sometable.somedata', 'sometable.somejson->somedata as somejsondata')

DB::table('sometable')->where('somejson->somedata', $id)->update(['somejson->otherdata' => 'newvalue']);

//works with string in MySQL & MariaDB 10.2.8
$query->where('somejson->something->somethingelse', 'somedata')

//works with string in MariaDB < 10.2.8
$query->where('somejson->something->somethingelse', '"somedata"')