This commit is contained in:
deploy-bot committed 2026-12-04 15:10:03 +00:00
commit 860182098c
277 files changed
+18338

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
<?php
namespace IriksIT\Manager\Models;
use Illuminate\Database\Eloquent\Model;
use IriksIT\Manager\Support\Names;
/** What one account chose for itself in the manager: its theme, which face of the manager it looks at, its language and where it stands with the tour. */
class UserSetting extends Model
{
protected $fillable = ['user_id', 'theme', 'view', 'locale', 'tutorial'];
/** The languages the screens come in. */
public const LOCALES = ['en', 'nl'];
/** Where an account stands with the tour: `pending` shows it at the next load; `done` and `skipped` never again until it is set to pending. */
public const TUTORIAL = ['pending', 'done', 'skipped'];
/** What this account chose (a row is made when it has none yet). */
public static function put(object $user, array $values): void
{
static::query()->updateOrCreate(['user_id' => $user->getKey()], $values);
}
/** One value of what this account chose, or null. */
public static function value(?object $user, string $column): ?string
{
return $user === null || $user->getKey() === null ? null : static::query()->where('user_id', $user->getKey())->value($column);
}
public function getTable(): string
{
return Names::table('user_settings');
}
}