thibaud-dt/trinitycore-models

TrinityCore数据库的Eloquent模型

0.1.1 2016-12-22 21:07 UTC

This package is auto-updated.

Last update: 2024-09-27 18:22:24 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads License

TrinityCore 3.3.5数据库的Eloquent模型。

TrinityCore数据库中表之间存在任何关系。此外,它分为3个不同的数据库:auth、characters和world

要求

  • PHP >= 5.5.9 || 7.0

安装

composer require thibaud-dt/trinitycore-models
  • 在config/database.php中添加数据库连接
'connections' => [

        [...]

        'characters' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST_CHARACTERS', 'localhost'),
            'database'  => env('DB_DATABASE_CHARACTERS', 'forge'),
            'username'  => env('DB_USERNAME_CHARACTERS', 'forge'),
            'password'  => env('DB_PASSWORD_CHARACTERS', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

        'world' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST_WORLD', 'localhost'),
            'database'  => env('DB_DATABASE_WORLD', 'forge'),
            'username'  => env('DB_USERNAME_WORLD', 'forge'),
            'password'  => env('DB_PASSWORD_WORLD', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

        'auth' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST_AUTH', 'localhost'),
            'database'  => env('DB_DATABASE_AUTH', 'forge'),
            'username'  => env('DB_USERNAME_AUTH', 'forge'),
            'password'  => env('DB_PASSWORD_AUTH', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ]

        [...]

    ],
  • 在.env中添加变量并配置它
DB_HOST_WORLD=localhost
DB_DATABASE_WORLD=world
DB_USERNAME_WORLD=root
DB_PASSWORD_WORLD=root

DB_HOST_CHARACTERS=localhost
DB_DATABASE_CHARACTERS=characters
DB_USERNAME_CHARACTERS=root
DB_PASSWORD_CHARACTERS=root

DB_HOST_AUTH=localhost
DB_DATABASE_AUTH=auth
DB_USERNAME_AUTH=root
DB_PASSWORD_AUTH=root

完成了!现在您可以使用此包了

用法

  • 所有模型都可以像Eloquent模型一样使用。

待办事项

  • 编写所有表的关联关系..还有很多工作要做!您可以通过pull request来帮助我 ;)

致谢

链接