1. Go to this page and download the library: Download jobmetric/laravel-barcode library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jobmetric / laravel-barcode example snippets
use JobMetric\Barcode\HasBarcode;
class Product extends Model
{
use HasBarcode;
}
use JobMetric\Barcode\Events\BarcodeableResourceEvent;
class AddProductResourceToBarcodableResourceListener
{
public function handle(BarcodeableResourceEvent $event)
{
$barcodeable = $event->barcodeable;
if ($barcodeable instanceof \App\Models\Product) {
$event->resource = new \App\Http\Resources\ProductResource($barcodeable);
}
}
}