there are other uses for lasers that projectile weapons don't satisfy easily.
there a high peak power, low total energy, laser ionizes a trail from the laser to the target device. then you send a bolt of lightning down that air column, which continues to ionize it while it electrically destroys the target. This can be used to disable vehicles non-lethally from remote distances. It can even be used to destroy roadside IEDs.
Another use, in fact the one it was originally researched for in the 1990s, is discharging lighting storms. In the 1990s there were multiple outages of the internet and other coms systems with astonishing price tags, due to lightning strikes. These don't seem to be as much of a problem now, at least not making the news. But at the time it looked like our new electronic infrastructure would need protecting.
ships are the ideal laser platform due to their abundant power and cooling, as well as their weight carring capacity, sturdy rigid platform, limited storage space for ordinance. Moreover ships are a highvalue asset that in recent years have been denied access to coastlines (littoral) due to proliferation of cheap anti-ship weapons. so defeating those is important to the navy. the main drawback with lasers is you can't fire them over the horizon, and thus the longer range weapon will always bee needed as well.