Download the PHP package vatgia/laravel-model without Composer
On this page you can find all versions of the php package vatgia/laravel-model. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download vatgia/laravel-model
More information about vatgia/laravel-model
Files in vatgia/laravel-model
Download vatgia/laravel-model
More information about vatgia/laravel-model
Files in vatgia/laravel-model
Vendor vatgia
Package laravel-model
Short Description Laravel model support multi connection format master - slaves. Connect random a slave with weight
License
Package laravel-model
Short Description Laravel model support multi connection format master - slaves. Connect random a slave with weight
License
Please rate this library. Is it a good library?
Informations about the package laravel-model
Vật Giá Laravel (Lumen) Model help connect multiple mysql database (master - slave) easy.
Functions
- Connect multiple databases with model master - slave
- Randomly connect 1 database slave with weight config
Sử dụng
Config follow bellow:
<?php
return [
'default' => 'master',
'connections' => [
'master' => [
'driver' => 'mysql',
'host' => env('DB_HOST'),
'port' => env('DB_PORT'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
'slaves' => [
'web31' => [
'driver' => 'mysql',
'read' => [
'host' => env('DB31_HOST'),
],
'write' => [
'host' => env('DB_HOST'),
],
'port' => env('DB_PORT'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'weight' => 100,
],
'web32' => [
'driver' => 'mysql',
'read' => [
'host' => env('DB32_HOST'),
],
'write' => [
'host' => env('DB_HOST'),
],
'port' => env('DB_PORT'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'weight' => 50,
],
'web33' => [
'driver' => 'mysql',
'read' => [
'host' => env('DB33_HOST'),
],
'write' => [
'host' => env('DB_HOST'),
],
'port' => env('DB_PORT'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'weight' => 50,
],
'web34' => [
'driver' => 'mysql',
'read' => [
'host' => env('DB34_HOST'),
],
'write' => [
'host' => env('DB_HOST'),
],
'port' => env('DB_PORT'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'weight' => 50,
],
],
],
];
Your model need extend from
Cách thay đổi database
MyModel::setConnection('master')
MyModel::setConnection('slavses')
MyModel::setConnection('slavses.web31')
All versions of laravel-model with dependencies
PHP Build Version
Package Version
The package vatgia/laravel-model contains the following files
Loading the files please wait ....