From 22141428711933b490675b7cc083bafcc25c99db Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Tue, 13 Dec 2022 14:04:25 +0100 Subject: [PATCH] switchable countries --- app/Http/Livewire/Frontend/Welcome.php | 23 ++++++++- composer.lock | 14 +++--- .../views/livewire/frontend/header.blade.php | 2 +- .../views/livewire/frontend/welcome.blade.php | 50 ++++++++++++++----- 4 files changed, 68 insertions(+), 21 deletions(-) diff --git a/app/Http/Livewire/Frontend/Welcome.php b/app/Http/Livewire/Frontend/Welcome.php index a5838ff5..afc0a4e3 100644 --- a/app/Http/Livewire/Frontend/Welcome.php +++ b/app/Http/Livewire/Frontend/Welcome.php @@ -2,12 +2,33 @@ namespace App\Http\Livewire\Frontend; +use App\Models\Country; use Livewire\Component; class Welcome extends Component { + public string $c = 'de'; + + protected $queryString = ['c']; + + public function rules() + { + return [ + 'c' => 'required', + ]; + } + + public function updated($property, $value) + { + $this->validate(); + + return to_route('welcome', ['c' => $value]); + } + public function render() { - return view('livewire.frontend.welcome')->layout('layouts.guest'); + return view('livewire.frontend.welcome', [ + 'countries' => Country::get(), + ])->layout('layouts.guest'); } } diff --git a/composer.lock b/composer.lock index b700041b..700063b0 100644 --- a/composer.lock +++ b/composer.lock @@ -4434,7 +4434,7 @@ }, { "name": "nova/start", - "version": "dev-blueprint", + "version": "dev-master", "dist": { "type": "path", "url": "./nova-components/Start", @@ -13815,16 +13815,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.19", + "version": "9.2.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559" + "reference": "af7463c955007de36db0c5e26d03e2f933c2e980" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559", - "reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/af7463c955007de36db0c5e26d03e2f933c2e980", + "reference": "af7463c955007de36db0c5e26d03e2f933c2e980", "shasum": "" }, "require": { @@ -13880,7 +13880,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.20" }, "funding": [ { @@ -13888,7 +13888,7 @@ "type": "github" } ], - "time": "2022-11-18T07:47:47+00:00" + "time": "2022-12-13T07:49:28+00:00" }, { "name": "phpunit/php-file-iterator", diff --git a/resources/views/livewire/frontend/header.blade.php b/resources/views/livewire/frontend/header.blade.php index 25e5bb86..75b60f38 100644 --- a/resources/views/livewire/frontend/header.blade.php +++ b/resources/views/livewire/frontend/header.blade.php @@ -11,7 +11,7 @@