noweh/eloquent-dual-database
Composer 安装命令:
composer require noweh/eloquent-dual-database
包简介
Custom Eloquent Builder for dual database.
关键字:
README 文档
README
This package provides a trait that override the Eloquent Builder in order to improve the management of Dual DB, with one DB for Read and Another for Write.
Indeed, this plugin allows you to retrieve freshly inserted data, even if the have not yet been duplicated on the Read Database.
Installation
First you need to add the component to your composer.json
composer require noweh/laravel-plugin-dual-database
Update your packages with composer update or install with composer install.
Simple Usage
Use the trait Noweh\EloquentDualDatabase\EloquentDualDatabaseTrait in your Model.
Example
use Noweh\EloquentDualDatabase\EloquentDualDatabaseTrait;
class MyModel extends Model
{
use EloquentDualDatabaseTrait;
...
}
Or, for a custom usage
Override the Eloquent Method newEloquentBuilder($query) in your Model.
Example
use Noweh\EloquentDualDatabase\CustomEloquentBuilder;
class MyModel extends Model
{
public function newEloquentBuilder($query): Builder
{
...
return new CustomEloquentBuilder($query);
}
...
}
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-02