mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
fixes #7
This commit is contained in:
@@ -45,13 +45,13 @@ class Header extends Component
|
|||||||
{
|
{
|
||||||
$this->timezone = config('app.user-timezone');
|
$this->timezone = config('app.user-timezone');
|
||||||
$this->l = Cookie::get('lang') ?: config('app.locale');
|
$this->l = Cookie::get('lang') ?: config('app.locale');
|
||||||
|
$this->c = Cookie::get('country') ?: config('app.country');
|
||||||
if (!$this->country) {
|
if (!$this->country) {
|
||||||
$this->country = Country::query()
|
$this->country = Country::query()
|
||||||
->where('code', $this->c)
|
->where('code', $this->c)
|
||||||
->first();
|
->first();
|
||||||
}
|
}
|
||||||
$this->currentRouteName = Route::currentRouteName();
|
$this->currentRouteName = Route::currentRouteName();
|
||||||
$this->c = $this->country->code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updatedTimezone($value)
|
public function updatedTimezone($value)
|
||||||
@@ -65,6 +65,7 @@ class Header extends Component
|
|||||||
|
|
||||||
public function updatedC($value)
|
public function updatedC($value)
|
||||||
{
|
{
|
||||||
|
Cookie::queue('country', $value, 60 * 24 * 365);
|
||||||
$url = str(request()->header('Referer'))->explode('/');
|
$url = str(request()->header('Referer'))->explode('/');
|
||||||
$url[3] = $value;
|
$url[3] = $value;
|
||||||
|
|
||||||
@@ -73,15 +74,13 @@ class Header extends Component
|
|||||||
|
|
||||||
public function updatedL($value)
|
public function updatedL($value)
|
||||||
{
|
{
|
||||||
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
Cookie::queue('lang', $value, 60 * 24 * 365);
|
||||||
|
|
||||||
return redirect(request()->header('Referer'));
|
return redirect(request()->header('Referer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
|
||||||
|
|
||||||
return view('livewire.frontend.header', [
|
return view('livewire.frontend.header', [
|
||||||
'news' => LibraryItem::query()
|
'news' => LibraryItem::query()
|
||||||
->with([
|
->with([
|
||||||
@@ -137,10 +136,13 @@ class Header extends Component
|
|||||||
->orderByDesc('date')
|
->orderByDesc('date')
|
||||||
->take(2)
|
->take(2)
|
||||||
->get(),
|
->get(),
|
||||||
'projectProposals' => ProjectProposal::query()->with([
|
'projectProposals' => ProjectProposal::query()
|
||||||
'votes',
|
->with([
|
||||||
'user',
|
'votes',
|
||||||
])->get(),
|
'user',
|
||||||
|
])
|
||||||
|
->take(2)
|
||||||
|
->get(),
|
||||||
'cities' => City::query()
|
'cities' => City::query()
|
||||||
->select(['latitude', 'longitude'])
|
->select(['latitude', 'longitude'])
|
||||||
->get(),
|
->get(),
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ class Welcome extends Component
|
|||||||
public function mount()
|
public function mount()
|
||||||
{
|
{
|
||||||
$this->l = Cookie::get('lang') ?: config('app.locale');
|
$this->l = Cookie::get('lang') ?: config('app.locale');
|
||||||
|
$this->c = Cookie::get('country') ?: config('app.country');
|
||||||
|
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
||||||
|
Cookie::queue('country', $this->c, 60 * 24 * 365);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updated($property, $value)
|
public function updated($property, $value)
|
||||||
@@ -43,14 +46,13 @@ class Welcome extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
||||||
|
Cookie::queue('country', $this->c, 60 * 24 * 365);
|
||||||
|
|
||||||
return to_route('welcome', ['c' => $c, 'l' => $l]);
|
return to_route('welcome', ['c' => $c, 'l' => $l]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
Cookie::queue('lang', $this->l, 60 * 24 * 365);
|
|
||||||
|
|
||||||
return view('livewire.frontend.welcome', [
|
return view('livewire.frontend.welcome', [
|
||||||
'countries' => Country::query()
|
'countries' => Country::query()
|
||||||
->select('id', 'name', 'code')
|
->select('id', 'name', 'code')
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class EncryptCookies extends Middleware
|
|||||||
* @var array<int, string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $except = [
|
protected $except = [
|
||||||
//
|
'lang',
|
||||||
|
'country',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ class SetTimezoneMiddleware
|
|||||||
public function handle(Request $request, Closure $next): Response
|
public function handle(Request $request, Closure $next): Response
|
||||||
{
|
{
|
||||||
App::setLocale(Cookie::get('lang') ?: config('app.locale'));
|
App::setLocale(Cookie::get('lang') ?: config('app.locale'));
|
||||||
|
if ($request->country) {
|
||||||
|
config([
|
||||||
|
'app.country' => $request->country,
|
||||||
|
]);
|
||||||
|
Cookie::queue('country', $request->country, 60 * 24 * 365);
|
||||||
|
}
|
||||||
if ($request->user()
|
if ($request->user()
|
||||||
&& $timezone = $request->user()->timezone
|
&& $timezone = $request->user()->timezone
|
||||||
) {
|
) {
|
||||||
|
|||||||
1008
composer.lock
generated
1008
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -88,6 +88,8 @@ return [
|
|||||||
|
|
||||||
'locale' => 'de',
|
'locale' => 'de',
|
||||||
|
|
||||||
|
'country' => 'de',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Fallback Locale
|
| Application Fallback Locale
|
||||||
|
|||||||
2
public/vendor/horizon/app.js
vendored
2
public/vendor/horizon/app.js
vendored
File diff suppressed because one or more lines are too long
2
public/vendor/horizon/mix-manifest.json
vendored
2
public/vendor/horizon/mix-manifest.json
vendored
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"/app.js": "/app.js?id=45904d8bd75c65ee5c136a52a5e8ead6",
|
"/app.js": "/app.js?id=c6187bff8d842d49dbb4d3de4b583600",
|
||||||
"/app-dark.css": "/app-dark.css?id=15c72df05e2b1147fa3e4b0670cfb435",
|
"/app-dark.css": "/app-dark.css?id=15c72df05e2b1147fa3e4b0670cfb435",
|
||||||
"/app.css": "/app.css?id=4d6a1a7fe095eedc2cb2a4ce822ea8a5",
|
"/app.css": "/app.css?id=4d6a1a7fe095eedc2cb2a4ce822ea8a5",
|
||||||
"/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f",
|
"/img/favicon.png": "/img/favicon.png?id=1542bfe8a0010dcbee710da13cce367f",
|
||||||
|
|||||||
Reference in New Issue
Block a user