1. Go to this page and download the library: Download ytake/laravel-couchbase 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/ */
ytake / laravel-couchbase example snippets
'providers' => [
// added service provider
\Ytake\LaravelCouchbase\CouchbaseServiceProvider::class,
\Ytake\LaravelCouchbase\ConsoleServiceProvider::class,
]
// service container access
$this->app['db']->connection('couchbase')
->table('testing')->where('whereKey', 'value')->first();
// use DB facades
\DB::connection('couchbase')
->table('testing')->where('whereKey', 'value')->get();
$this->app['db']->connection('couchbase')
->callableConsistency(\CouchbaseN1qlQuery::REQUEST_PLUS, function ($con) {
return $con->table('testing')->where('id', 1)->returning(['id', 'name'])->get();
});
use Ytake\LaravelCouchbase\Schema\Blueprint as CouchbaseBlueprint;
\Schema::create('samples', function (CouchbaseBlueprint $table) {
$table->primaryIndex(); // primary index
$table->index(['message', 'identifier'], 'sample_secondary_index'); // secondary index
// dropped
$table->dropIndex('sample_secondary_index');
$table->dropPrimary();
});