likesistemas / eloquent-external
本包最新版本(v1.2.0)没有可用的许可证信息。
在不与 Laravel 框架链接的情况下使用 eloquent。
v1.2.0
2022-05-03 16:45 UTC
Requires
- php: >=5.6.40
- fakerphp/faker: ^1.9
- illuminate/database: ^5.4 || ^7.0
- illuminate/events: ^5.4 || ^7.0
- psr/container: =1.0.0
- symfony/finder: ^3.4 || ^5.0
Requires (Dev)
- phpunit/phpunit: ^5.0 || ^9.0
- yoast/phpunit-polyfills: ^1.0
README
安装
composer require likesistemas/eloquent-external
如何使用
使用类 ConfigBean
use Illuminate\Container\Container; use Like\Database\Config; use Like\Database\ConfigBean; use Like\Database\Eloquent; $config = new ConfigBean( 'host', 'user', 'password', 'db_name' ); $config->setFactoryFolder(__DIR__ . "/./factories/"); # Folder where all the Eloquent factories are. $config->addFakerProvider(ProdutoProvider::class); # Optional. Use to add new providers to Faker. Note: you can add as many as you like. # If you are configuring the settings in the same file that will start, you can pass the config by parameter. Eloquent::init($config); # Or set using `illuminate\container` and run init without parameter. Container::getInstance()->instance(Config::class, $config); # Then call `init` wherever you think is best, without having to pass parameters. Eloquent::init();