diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 328e56b..82daa0d 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -19,9 +19,10 @@ jobs: strategy: fail-fast: true matrix: - php: [ 8.0, 8.1, 8.2, 8.3, 8.4 ] + php: [ 8.0, 8.1, 8.2, 8.3 ] + thinkphp: [ "~8.0.3", "^8.1"] - name: PHP${{ matrix.php }} + name: ThinkPHP${{ matrix.thinkphp }}-PHP${{ matrix.php }} steps: - name: Checkout code @@ -42,13 +43,15 @@ jobs: uses: actions/cache@v3 with: path: vendor - key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.thinkphp }}-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-${{ matrix.php }} + ${{ runner.os }}-${{ matrix.php }}-${{ matrix.thinkphp }} - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' - run: composer install --prefer-dist --no-progress --no-suggest + run: | + composer require topthink/framework:${{ matrix.thinkphp }} --no-update --no-interaction + composer install --prefer-dist --no-progress --no-suggest - name: Run test suite run: ./vendor/bin/phpunit diff --git a/src/model/Rule.php b/src/model/Rule.php index c87cc5a..ad29d40 100644 --- a/src/model/Rule.php +++ b/src/model/Rule.php @@ -12,6 +12,18 @@ class Rule extends Model implements Arrayable { use Configurable; + + protected $name; + + // 设置当前模型对应的完整数据表名称 + protected $table; + + // 设置当前模型的数据库连接 + protected $connection; + + // 默认主键 + protected $pk = 'id'; + /** * 设置字段信息 * @@ -37,6 +49,7 @@ public function __construct(array|object $data = []) $this->connection = $this->config('database.connection') ?: ''; $this->table = $this->config('database.rules_table'); $this->name = $this->config('database.rules_name'); + parent::__construct($data); } }