Skip to content

Commit

Permalink
Set default lazy-setting type and allow nullable field type
Browse files Browse the repository at this point in the history
Added a default type 'string' configuration for lazy-setting. Modified `getFieldType` method to accept nullable strings, enhancing flexibility in field type handling.
  • Loading branch information
CrazyBoy49z committed Sep 8, 2024
1 parent f63fe68 commit 2baeba0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/LazySetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function createIfNotExists(string $key, mixed $data, ?string $type = null
return $setting;
}

public function getFieldType(string $type = ''): string
public function getFieldType(string|null $type = ''): string
{
$type = strtolower(trim($type));

Expand Down
1 change: 1 addition & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function getEnvironmentSetUp($app): void
config()->set('database.default', 'testing');
config()->set('database.connections.testing.prefix', '');
config()->set('lazy.setting.table', 'settings');
config()->set('lazy-setting.default.type', 'string');

$migration = include __DIR__.'/../database/migrations/create_lazy_setting_table.php.stub';
$migration->up();
Expand Down

0 comments on commit 2baeba0

Please sign in to comment.