diff --git a/.github/workflows/test-runner.yml b/.github/workflows/test-runner.yml index 75d06db..7c73a73 100644 --- a/.github/workflows/test-runner.yml +++ b/.github/workflows/test-runner.yml @@ -65,7 +65,7 @@ jobs: - name: Install dependencies run: | - composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "filament/support:^3.3" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress --no-interaction - name: Run test suite diff --git a/src/Models/Country.php b/src/Models/Country.php index 4803e42..1203377 100644 --- a/src/Models/Country.php +++ b/src/Models/Country.php @@ -90,4 +90,18 @@ protected static function newFactory(): CountryFactory { return CountryFactory::new(); } + + /** + * Ensure numeric code is always stored as a 3-character, zero-padded string. + */ + public function setNumCodeAttribute($value): void + { + if ($value === null || $value === '') { + $this->attributes['num_code'] = null; + + return; + } + + $this->attributes['num_code'] = str_pad((string) $value, 3, '0', STR_PAD_LEFT); + } }