switch year

This commit is contained in:
Benjamin Takats
2022-12-15 19:28:04 +01:00
parent 04b28b924d
commit 1857269b38
4 changed files with 25 additions and 13 deletions

View File

@@ -9,25 +9,32 @@ use Livewire\Component;
class BitcoinEventTable extends Component
{
public Country $country;
public ?int $year = null;
protected $queryString = ['year'];
public function render()
{
return view('livewire.bitcoin-event.bitcoin-event-table', [
'events' => BitcoinEvent::query()
->get()
->map(fn($event) => [
'id' => $event->id,
'startDate' => $event->from,
'endDate' => $event->to,
'location' => $event->title,
'description' => $event->description,
]),
->get()
->map(fn($event) => [
'id' => $event->id,
'startDate' => $event->from,
'endDate' => $event->to,
'location' => $event->title,
'description' => $event->description,
]),
]);
}
public function popover($content, $ids)
{
return to_route('bitcoinEvent.table.bitcoinEvent', [
'country' => $this->country->code, 'table' => [
'country' => $this->country->code,
'year' => $this->year,
'table' => [
'filters' => [
'byid' => $ids,
]