PolarDbModel.php 535 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Elton
  5. * Date: 2020/4/9
  6. * Time: 17:50
  7. */
  8. namespace app\common\model;
  9. use think\Config;
  10. use think\Model;
  11. class PolarDbModel extends Model
  12. {
  13. /**
  14. * PolarDbModel constructor.
  15. * @param array $data
  16. * @param bool $isPolarDb 是否使用PolarDb 数据库
  17. */
  18. public function __construct($data = [], $isPolarDb = true)
  19. {
  20. if ($isPolarDb) {
  21. $this->connection = Config::get('polardb') ?? [];
  22. }
  23. parent::__construct($data);
  24. }
  25. }