mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Livewire\Frontend;
|
|
|
|
use App\Models\Country;
|
|
use Illuminate\Support\Facades\Cookie;
|
|
use Livewire\Component;
|
|
use RalphJSmit\Laravel\SEO\Support\SEOData;
|
|
|
|
class Welcome extends Component
|
|
{
|
|
public string $c = 'de';
|
|
public string $l = 'de';
|
|
|
|
protected $queryString = ['l'];
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
'c' => 'required',
|
|
'l' => 'required',
|
|
];
|
|
}
|
|
|
|
public function mount()
|
|
{
|
|
$this->l = Cookie::get('lang') ?: config('app.locale');
|
|
}
|
|
|
|
public function updated($property, $value)
|
|
{
|
|
$this->validate();
|
|
|
|
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
|
|
|
return to_route('welcome', ['c' => $this->c, 'l' => $this->l]);
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
|
|
|
return view('livewire.frontend.welcome', [
|
|
'countries' => Country::get(),
|
|
])->layout('layouts.guest', [
|
|
'SEOData' => new SEOData(
|
|
image: asset('img/screenshot.png')
|
|
)
|
|
]);
|
|
}
|
|
}
|