Now a days, adding Barcode system in web application is most asking feature. Manually inputting products id for making invoice or finding products is really time consuming and have a chance to make mistake.
In this situation, Barcode system makes workflow faster and error free! In Laravel it is quit easy to implement barcode system. Even you don't need any physical barcode reader machine! yah, It's true!
Topics
- Generate Barcode
- Scanning barcode without physical barcode scanner!
Generate Barcode
Let's generate barcode first. To do that, add milon/barcode
package first.
composer require milon/barcode
Suppose, we have products ID like P-10001, P-10002, P-10003 and so on. To generate custom database ID like this, you can use Laravel ID generator.
Controller code
public function barcode(Request $request){
$product = Product::find($request->get('id'));
return view('barcode',compact('product'));
}
View code
<div class="barcode">
<p>{{$product->name}}</p>
<p>Price: {{$product->sale_price}}</p>
{!! DNS1D::getBarcodeHTML($product->id, "C128",1.4,22) !!}
<p>{{$product->id}}</p>
</div>
Note: Style the barcode
css class according to your need. Please keep in mind most commonly used barcode sticker for printing barcode is 100x150mm
Scanning barcode without physical scanner!
After generating barcode basically we need a real physical barcode scanner for scanning barcode from product sticker and feed the code into our application but there is a free solution where you don't need physical barcode reader!
Barcode Client Server is a free barcode reader android application which can read barcode and send it to your PC. It's free and there is no scan limit!
How the Barcode Client Server works
- Install the app for PC barcode server
- Download the Barcode client server from playstore
- Connect the app to PC server application.
Now when you scan any barcode by android app, it'll send scanned code to your PC immediately 👌
Top comments (0)