PHP code example of getghostr / cockroachdb-laravel

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

    

getghostr / cockroachdb-laravel example snippets


Ghostr\Cockroach\CockroachServiceProvider::class,

'cockroach' => [
    'driver' => 'cockroach',
    'url' => env('DATABASE_URL'),
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '5432'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'charset' => 'utf8',
    'prefix' => '',
    'prefix_indexes' => true,
    'schema' => 'public',
    'sslmode' => 'prefer',
],

Schema::table('my_table', function (Blueprint $table) {
    // Single stored column
    $table->index('col1')->storing('col2');
    
    // Multiple stored columns
    $table->index('col1')->storing(['col2', 'col3'])
})