Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once __DIR__ . '/../bootstrap/init.php';
- $app_name = getenv('APP_NAME');
- use IlluminateDatabaseCapsuleManager as Capsule;
- $user = Capsule::table('users')->where('id', 1)->first();
- APP_ENV = local
- APP_NAME = "ACME E-commerce store"
- #database
- DB_DRIVER=mysql
- DB_HOST=localhost
- DB_NAME=store
- DB_USERNAME=store
- DB_PASSWORD=secret
- public function __construct()
- {
- $db = new Capsule;
- $db->addConnection([
- 'driver' => getenv('DB_DRIVER'),
- 'host' => getenv('DB_HOST'),
- 'database' => getenv('DB_NAME'),
- 'username' => getenv('DB_USERNAME'),
- 'password' => getenv('DB_PASSWORD'),
- 'charset' => 'utf8',
- 'collation' => 'utf8_unicode_ci',
- 'prefix' => ' '
- ]);
- $db->setAsGlobal();
- $db->bootEloquent();
- }
Add Comment
Please, Sign In to add comment