As Dave said, you cannot access the camera from the server-side code. Which means you need to access it from Javascript.
Fortunately, there's an API for that:
MediaDevices.getUserMedia() - Web APIs | MDN[
^]
It has fairly broad support, but you will need to make sure your site is served via HTTPS to use it.
And before you ask, no, there is no way to bypass the permission prompt.
Once you have the image, you will need to scan it for a barcode. You can either send the image to the server to do that, or use a client-side library. Google will find several examples - eg:
QuaggaJS[
^],
zxing-js[
^], etc.