Skip to content

Commit acbdb9d

Browse files
author
Itamar Junior
committed
feat: persist selected company in session and auto-load contracts on page load
1 parent 134faae commit acbdb9d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/Livewire/Company/BudgetForecast.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ public function mount()
1919
->orderBy('name')
2020
->get();
2121

22-
$this->selectedCompanyId = null;
22+
$this->selectedCompanyId = session('selectedCompanyId');
23+
24+
if ($this->selectedCompanyId) {
25+
$this->loadContracts();
26+
}
2327
}
2428

2529
public function updatedSelectedCompanyId($value)
2630
{
31+
session(['selectedCompanyId' => $value]);
2732
$this->loadContracts();
2833
}
2934

0 commit comments

Comments
 (0)