-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomposer_php.php
More file actions
48 lines (34 loc) · 1.13 KB
/
Copy pathcomposer_php.php
File metadata and controls
48 lines (34 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/*
* Plugin Name: composer php sample
* Plugin URI: https://so0shi.com/
* Description: this is a sample for composercd
* Author: so0shi-vulture
* Author URI: https://so0shi.com/
* Version: 1.0.0
*/
define('PHP_COMPOSER_ROOT', plugin_dir_path(__FILE__));
require PHP_COMPOSER_ROOT . 'vendor/autoload.php';
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'wordpress.exp',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => 'exp_',
]);
// Set the event dispatcher used by Eloquent models... (optional)
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$capsule->setEventDispatcher(new Dispatcher(new Container));
// Make this Capsule instance available globally via static methods... (optional)
$capsule->setAsGlobal();
// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$capsule->bootEloquent();
use App\models\User;
$users = User::get();
var_dump($users->first()->user_login);