mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-11 08:04:09 -08:00
42 lines
858 B
PHP
42 lines
858 B
PHP
<?php
|
|
|
|
namespace Tests\Support;
|
|
|
|
use App\Models\Setting;
|
|
|
|
class Settings
|
|
{
|
|
private Setting $setting;
|
|
|
|
private function __construct()
|
|
{
|
|
$this->setting = Setting::factory()->create();
|
|
}
|
|
|
|
public static function initialize(): Settings
|
|
{
|
|
return new self();
|
|
}
|
|
|
|
public function enableMultipleFullCompanySupport(): Settings
|
|
{
|
|
return $this->update(['full_multiple_companies_support' => 1]);
|
|
}
|
|
|
|
/**
|
|
* @param array $attributes Attributes to modify in the application's settings.
|
|
*/
|
|
public function set(array $attributes): Settings
|
|
{
|
|
return $this->update($attributes);
|
|
}
|
|
|
|
private function update(array $attributes): Settings
|
|
{
|
|
Setting::unguarded(fn() => $this->setting->update($attributes));
|
|
Setting::$_cache = null;
|
|
|
|
return $this;
|
|
}
|
|
}
|