settings added

This commit is contained in:
HolgerHatGarKeineNode
2023-02-26 14:28:20 +01:00
parent 41c98b4162
commit 4a43b5f1d5
15 changed files with 93 additions and 30 deletions

View File

@@ -23,20 +23,26 @@ class Header extends Component
public string $l = 'de';
public string $timezone;
public $bgColor = 'bg-21gray';
protected $queryString = ['l'];
protected $listeners = ['refresh' => '$refresh'];
public function rules()
{
return [
'c' => 'required',
'l' => 'required',
'c' => 'required',
'l' => 'required',
'timezone' => 'required',
];
}
public function mount()
{
$this->timezone = config('app.user-timezone');
$this->l = Cookie::get('lang') ?: config('app.locale');
if (!$this->country) {
$this->country = Country::query()
@@ -47,6 +53,15 @@ class Header extends Component
$this->c = $this->country->code;
}
public function updatedTimezone($value)
{
auth()
->user()
->update(['timezone' => $value]);
return redirect(request()->header('Referer'));
}
public function updatedC($value)
{
return to_route($this->currentRouteName, ['country' => $value, 'lang' => $this->l]);