Skip to content

Commit

Permalink
Add method to retrieve preferences and change defaultModels visibility.
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <[email protected]>
  • Loading branch information
sampoyigi committed Dec 10, 2024
1 parent 0d40bd6 commit 8f8dd9d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/System/Models/Concerns/Defaultable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

trait Defaultable
{
protected static array $defaultModels = [];
public static array $defaultModels = [];

public static function bootDefaultable()
{
Expand Down Expand Up @@ -64,7 +64,7 @@ public function makeDefault(): bool
if ($this->defaultableUsesSwitchable()) {
if (!$this->{$this->switchableGetColumn()}) {
throw ValidationException::withMessages([$this->switchableGetColumn() => sprintf(
lang('igniter::admin.alert_error_set_default'), $this->defaultableName()
lang('igniter::admin.alert_error_set_default'), $this->defaultableName(),
)]);
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/System/Models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ public static function setPref(string|array $key, mixed $value = null): bool
return self::set($key, $value, 'prefs');
}

public static function getPref(string|array $key, mixed $value = null): bool
{
return self::get($key, $value, 'prefs');
}

public static function make($attributes = [])
{
return resolve(static::class);
Expand Down Expand Up @@ -292,7 +297,7 @@ public function registerSettingItems($owner, array $definitions)
if (!isset($item['url'])) {
$item['url'] = admin_url($owner == 'core'
? 'settings/edit/'.$code
: 'extensions/edit/'.str_replace('.', '/', $owner).'/'.$code
: 'extensions/edit/'.str_replace('.', '/', $owner).'/'.$code,
);
}

Expand Down

0 comments on commit 8f8dd9d

Please sign in to comment.