mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
country flags added and country switcher added
This commit is contained in:
@@ -8,6 +8,24 @@ use Livewire\Component;
|
||||
class SearchCities extends Component
|
||||
{
|
||||
public Country $country;
|
||||
public string $c = 'de';
|
||||
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'c' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->c = $this->country->code;
|
||||
}
|
||||
|
||||
public function updatedC($value)
|
||||
{
|
||||
return to_route('search.cities', ['country' => $value]);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
namespace App\Http\Livewire\Tables;
|
||||
|
||||
use App\Models\City;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Rappasoft\LaravelLivewireTables\DataTableComponent;
|
||||
use Rappasoft\LaravelLivewireTables\Views\Column;
|
||||
|
||||
class CityTable extends DataTableComponent
|
||||
{
|
||||
public string $country;
|
||||
|
||||
protected $model = City::class;
|
||||
|
||||
public function configure(): void
|
||||
@@ -23,4 +26,10 @@ class CityTable extends DataTableComponent
|
||||
->searchable(),
|
||||
];
|
||||
}
|
||||
|
||||
public function builder(): Builder
|
||||
{
|
||||
return City::query()
|
||||
->whereHas('country', fn($query) => $query->where('code', $this->country));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user