Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 13 additions & 0 deletions src/model/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
class Rule extends Model implements Arrayable
{
use Configurable;

protected $name;

// 设置当前模型对应的完整数据表名称
protected $table;

// 设置当前模型的数据库连接
protected $connection;

// 默认主键
protected $pk = 'id';

/**
* 设置字段信息
*
Expand All @@ -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);
}
}