Allow Settings to be chainable

This commit is contained in:
Marcus Moore 2023-04-06 18:46:29 -07:00
parent 9561b66613
commit cd0796ddda
No known key found for this signature in database

View file

@ -18,22 +18,24 @@ class Settings
return new self(); return new self();
} }
public function enableMultipleFullCompanySupport(): void public function enableMultipleFullCompanySupport(): Settings
{ {
$this->update(['full_multiple_companies_support' => 1]); return $this->update(['full_multiple_companies_support' => 1]);
} }
/** /**
* @param array $attributes Attributes to modify in the application's settings. * @param array $attributes Attributes to modify in the application's settings.
*/ */
public function set(array $attributes): void public function set(array $attributes): Settings
{ {
$this->update($attributes); return $this->update($attributes);
} }
private function update(array $attributes): void private function update(array $attributes): Settings
{ {
Setting::unguarded(fn() => $this->setting->update($attributes)); Setting::unguarded(fn() => $this->setting->update($attributes));
Setting::$_cache = null; Setting::$_cache = null;
return $this;
} }
} }