diff --git a/app/Livewire/Vault/Index.php b/app/Livewire/Vault/Index.php index c731f17..0842f21 100644 --- a/app/Livewire/Vault/Index.php +++ b/app/Livewire/Vault/Index.php @@ -64,7 +64,7 @@ final class Index extends Component $currentUser = auth()->user(); return view('livewire.vault.index', [ - 'vaults' => $currentUser->vaults()->orderBy('updated_at', 'DESC')->get(), + 'vaults' => $currentUser->vaults()->orderBy('opened_at', 'DESC')->get(), ]); } } diff --git a/app/Livewire/Vault/Show.php b/app/Livewire/Vault/Show.php index 7f72df9..fecf3b2 100644 --- a/app/Livewire/Vault/Show.php +++ b/app/Livewire/Vault/Show.php @@ -43,13 +43,16 @@ final class Show extends Component public function mount(Vault $vault): void { $this->authorize('view', $vault); + new UpdateVault()->handle($vault, [ + 'opened_at' => now(), + ]); $this->vault = $vault; $this->vaultForm->setVault($this->vault); $this->nodeForm->setVault($this->vault); $this->getTemplates(); if ((int) $this->selectedFile > 0) { - $selectedFile = $vault->nodes() + $selectedFile = $this->vault->nodes() ->where('id', $this->selectedFile) ->where('is_file', true) ->first();