Skip to content

Instantly share code, notes, and snippets.

@anderson-marin26
Created July 14, 2017 12:11
Show Gist options
  • Save anderson-marin26/e61301aab4b50c25bdb2601c27aa57ff to your computer and use it in GitHub Desktop.
Save anderson-marin26/e61301aab4b50c25bdb2601c27aa57ff to your computer and use it in GitHub Desktop.
Eloquent Capsule Example
<?php
require "vendor/autoload.php";
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule();
$array = array(
'driver' => 'mysql',
'host' => '127.0.0.1',
'database' => 'db_name',
'username' => 'root',
'password' => 'paswd',
'charset' => 'utf8',
'collation' => 'utf8_general_ci'
);
$capsule->addConnection($array);
$capsule->setAsGlobal();
$capsule->bootEloquent();
date_default_timezone_set('UTC');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment