2017 © Pedro Peláez
 

library laravel-table

laravel table shard compents

image

xiaolin/laravel-table

laravel table shard compents

  • Monday, July 9, 2018
  • by missxiaolin
  • Repository
  • 0 Watchers
  • 4 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

laravel-table

Laravel Table Sharding, (*1)

安装

composer xialin/table

注入

'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Notifications\NotificationServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,

    /*
     * Package Service Providers...
     */

    /*
     * Application Service Providers...
     */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    // App\Providers\BroadcastServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,

    \OkamiChen\TableShard\TableShardProvider::class, // 分表

],

创建

use Illuminate\Database\Eloquent\Model;

use OkamiChen\TableShard\Traits\TableShard;


class User extends Model {

    use TableShard;

    /**
     * 分表建值
     * @return string
     */
    public function getShardKey()
    {
        return 'user_id';
    }

    /**
     * 分表个数
     * @return int
     */
    public function getShardNum()
    {
        return 10;
    }

}

查询

User::where(['user_id'=>18])->first();

The Versions

09/07 2018

dev-master

9999999-dev

laravel table shard compents

  Sources   Download

MIT

The Requires

 

The Development Requires

by 小林

28/06 2018

0.0.5

0.0.5.0

laravel table shard compents

  Sources   Download

MIT

The Requires

 

The Development Requires

by 小林

28/06 2018

0.0.4

0.0.4.0

laravel table shard compents

  Sources   Download

MIT

The Requires

 

The Development Requires

by 小林

28/06 2018

0.0.3

0.0.3.0

laravel table shard compents

  Sources   Download

MIT

The Requires

 

The Development Requires

by 小林

27/06 2018

0.0.2

0.0.2.0

laravel table shard compents

  Sources   Download

MIT

The Requires

 

The Development Requires

by 小林

27/06 2018

0.0.1

0.0.1.0

laravel table shard compents

  Sources   Download

MIT

The Requires

 

The Development Requires

by 小林