private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get(); } public function setPrivateKey($private_key_id) { $this->private_key_id = $private_key_id; } public function addPrivateKey() { $this->new_private_key_value = trim($this->new_private_key_value); if (!str_ends_with($this->new_private_key_value, "\n")) { $this->new_private_key_value .= "\n"; } PrivateKey::create([ 'name' => $this->new_private_key_name, 'description' => $this->new_private_key_description, 'private_key' => $this->new_private_key_value, 'team_id' => session('currentTeam')->id ]); session('currentTeam')->privateKeys = $this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get(); } public function submit() { $server = Server::create([ 'name' => fake()->company, 'ip' => $this->ip, 'user' => $this->user, 'port' => $this->port, 'team_id' => session('currentTeam')->id, 'private_key_id' => $this->private_key_id ]); return redirect()->route('server.show', $server->uuid); } }