currentRoute = Route::current()->uri(); } public function createPrivateKey() { $this->value = trim($this->value); if (!str_ends_with($this->value, "\n")) { $this->value .= "\n"; } $new_private_key = PrivateKey::create([ 'name' => $this->name, 'description' => $this->description, 'private_key' => $this->value, 'team_id' => session('currentTeam')->id ]); session('currentTeam')->privateKeys = PrivateKey::where('team_id', session('currentTeam')->id)->get(); if ($this->currentRoute !== 'server/new') { redirect()->route('private-key.show', $new_private_key->uuid); } } }