How do I make a laser pointer?

I am making a top down shooter and I would like to know how to make a laser pointer. I currently have a directional light, but that only shows where it hits, I want it to light up it's whole path in a small beam.

maybe the code would be like this?:

function Update () {
    var lineRenderer : LineRenderer = GetComponent(LineRenderer);
    lineRenderer.useWorldSpace = false;
    lineRenderer.SetVertexCount(2);
    var hit : RaycastHit;
    Physics.Raycast(transform.position,transform.forward,hit);
    if(hit.collider){
    lineRenderer.SetPosition(1,Vector3(0,0,hit.distance));
    }
    else{
        lineRenderer.SetPosition(1,Vector3(0,0,5000));
    }
}

@script RequireComponent(LineRenderer)

and use a texture like this

I think you want a Line Renderer.