How to transform Vector3 to quaternion

Trying to spawn gameobjects with a specfic rotation so when it’s spawned it it goes forward to wherever it’s rotated to. But it always spawns rotated default (local axis facing world axis). I assume it’s because I didn’t properly converted Vector3 to Quaternion. Btw raycast’s work as intended. I appreciate any help.

int x = -45;
            if (gunProp.gunType == GunManager.GunType.Shotgun)
            {

                for (int i = 0; i < 15; i++)
                {
                    dir = Quaternion.AngleAxis(x, Vector3.up) * bulletSpawn.forward;
                    Ray ray1 = new Ray(bulletSpawn.position, dir);
                    RaycastHit hit;

                    if (Physics.Raycast(ray1, out hit, gunProp.shootDistance))
                    {
                        gunProp.shootDistance = hit.distance;
                    }
                    Debug.DrawRay(ray1.origin, ray1.direction * gunProp.shootDistance, Color.red, 1);
                    spawnVfx(dir);

                    x = x + 6;
                }
            }
void spawnVfx(Vector3 a)
    {
        GameObject vfx;
        if (bulletSpawn != null)
            vfx = Instantiate(effectToSpawn, bulletSpawn.position, Quaternion.Euler(a));
    }

Euler angles do not represent a vector in any particular space. They are just angles which denote consecutive rotations around 3 axis. You seem to have a direction vector and what a rotation that looks along that direction. For this we have the Quaternion.LookRotation method. It takes 2 direction vectors. The first is the primary direction which defines the blue(z axis) of the rotation. The second is just a hint to determine where up should be. If you do not specify the second vector it will simply use Vector3.up.

vfx = Instantiate(effectToSpawn, bulletSpawn.position, Quaternion.LookRotation(a));