Commit a5717470 by lujunyi

合并master到develop

parents 1ce170d0 b567b75b
......@@ -103,7 +103,7 @@ protected function grid()
$filter->in('is_open', '开店状态')->checkbox(PharmacyModel::IS_OPEN_MAP)->width(3);
$filter->in('is_auto', '自动审方')->checkbox(PharmacyModel::IS_AUTO_MAP)->width(3);
});
$grid->setActionClass(Grid\Displayers\Actions::class);
// 行按钮控制
// $grid->disableDeleteButton(); // 禁用删除按钮
$grid->disableViewButton(); // 禁用详情按钮
......@@ -111,7 +111,6 @@ protected function grid()
// 工具栏按钮控制
$grid->disableBatchActions(); // 禁用批量操作
}
});
}
......@@ -174,7 +173,8 @@ protected function form()
}
});
$form->timeRange('business_start', 'business_end', '营业时间')->required();
$form->map('lat', 'lng', '经纬度坐标');
$form->text('lat')->help('举例:30.43836。江苏的纬度范围是:30.45到35.08');
$form->text('lng')->help('举例:120.681244。江苏的经度范围是:116.18到121.57');
// $form->select('user_id')->options(User::all()->pluck('openid', 'id'))->width(6)->help('实际后台操作可以不用关联');
if ($form->isEditing() && ! Admin::user()->isRole('pharmacy')) {
$form->switch('status');
......
......@@ -78,7 +78,7 @@ protected function grid()
$filter->expand(); // 默认展开搜索框
$filter->equal('pharmacy_id')->select(PharmacyModel::all()->pluck('name', 'id'))->width(3);
$filter->like('id','处方单编号')->width(3);
$filter->like('id', '处方单编号')->width(3);
$filter->like('patient_name')->width(3);
$filter->like('diagnosis_name')->width(3);
$filter->in('status')->checkbox(PrescriptionModel::PRESCRIPTION_STATUS_MAP)->width(3);
......
......@@ -42,7 +42,7 @@ public function form()
$this->number('drug_choose_limit', '选择药品限制')->required()->default(($data['drug_choose_limit'] ?? 5))->min(1)->max(5)->help('药品目录选择数,最多可设置5');
// $this->switch('prescription_auto', '医师自动开方')->default(($data['prescription_auto'] ?? 0));
$this->text('limit_keywords','限制关键词')->default($data['limit_keywords'] ?? '')->required()->help('多个关键词请用英文逗号分隔');
$this->text('limit_keywords', '限制关键词')->default($data['limit_keywords'] ?? '')->required()->help('多个关键词请用英文逗号分隔');
$this->disableResetButton();
}
......
......@@ -2,6 +2,8 @@
namespace App\Admin\Extensions\ToolBar\Forms;
use App\Models\DosageModel;
use App\Models\PharmacyDrugModel;
use App\Models\PharmacyModel;
use Dcat\Admin\Http\JsonResponse;
use Dcat\Admin\Widgets\Form;
......@@ -36,10 +38,12 @@ public function handle(array $input): JsonResponse
return is_string($value) ? trim($value) : $value;
}, $row);
$pharmacyModel = null;
$flagNew = false;
if (isset($item['药店管理员手机号']) && $item['药店管理员手机号']) {
$pharmacyModel = PharmacyModel::where('mobile', $item['药店管理员手机号'])->first();
}
if (! $pharmacyModel) {
$flagNew = true;
$pharmacyModel = new PharmacyModel;
}
$pharmacyModel->name = $item['药店名称'] ?? 0;
......@@ -51,6 +55,22 @@ public function handle(array $input): JsonResponse
if ($pharmacyModel->save()) {
$successNum++;
}
if ($flagNew) {
// 复制药品
$originalPharmacyModels = PharmacyDrugModel::where('pharmacy_id', 1)->get();
foreach ($originalPharmacyModels as $originalPharmacyModel) {
$pharmacyNewModel = $originalPharmacyModel->replicate();
$pharmacyNewModel->pharmacy_id = $pharmacyModel->id;
$pharmacyNewModel->save();
}
// 复制用法用量
$originalDosageModels = DosageModel::where('pharmacy_id', 1)->get();
foreach ($originalDosageModels as $dosageModel) {
$dosageNewModel = $dosageModel->replicate();
$dosageNewModel->pharmacy_id = $pharmacyModel->id;
$dosageNewModel->save();
}
}
}
});
$return = $this->response()->success("导入成功{$successNum}条")->refresh();
......
......@@ -205,9 +205,9 @@ public function delete(Request $request)
if (! $pharmacy) {
return $this->failed('该药店不存在');
}
# 判断该药店下是否有几个开启的药师
// 判断该药店下是否有几个开启的药师
$pharmacist = PharmacistModel::where('pharmacy_id', $pharmacy->id)->where('status', 1)->count();
if( $pharmacist <= 1 ){
if ($pharmacist <= 1) {
return $this->failed('无法删除,至少需要一个开启的药师!');
}
$id = $request->input('id');
......
......@@ -3,35 +3,32 @@
namespace App\Api\Controllers;
use App\Http\Controllers\BaseApiController;
use App\Models\DoctorModel;
use App\Models\PharmacyModel;
use App\Models\User;
use App\Services\SmsService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Overtrue\EasySms\EasySms;
class SiteConfigController extends BaseApiController
{
public function test(){
public function test()
{
$site_config = admin_setting_array('site_config');
Log::info('测试', $site_config);
$data = [
'diagnosis_limit' => $site_config['diagnosis_limit'],
'drug_choose_limit' => $site_config['drug_choose_limit'],
];
return $this->success($data);
}
public function config(Request $request)
{
$site_config = admin_setting_array('site_config');
# Log::info('测试', $site_config);
// Log::info('测试', $site_config);
$data = [
'diagnosis_limit' => $site_config['diagnosis_limit'],
'drug_choose_limit' => $site_config['drug_choose_limit'],
];
return $this->success($data);
}
}
......@@ -32,10 +32,11 @@ class PharmacistModel extends Model
self::IS_DEFAULT_TRUE => 'success',
];
// 是否启用[0=否,1=是]
const IS_STATUS_FALSE = 0;
const IS_STATUS_TRUE = 1;
const IS_STATUS_MAP = [
self::IS_STATUS_FALSE => '否',
self::IS_STATUS_TRUE => '是',
......
......@@ -16,6 +16,7 @@
"laravel/helpers": "^1.6",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8",
"milon/barcode": "^11.0",
"overtrue/easy-sms": "^3.0",
"overtrue/laravel-filesystem-cos": "^3.5",
"overtrue/laravel-query-logger": "^3.1",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "49823373b75af40f543b069d0d73c169",
"content-hash": "d80910c6b7b6c170f19efa978bbbffca",
"packages": [
{
"name": "box/spout",
......@@ -3010,6 +3010,80 @@
"time": "2024-09-21T08:32:55+00:00"
},
{
"name": "milon/barcode",
"version": "v11.0.0",
"source": {
"type": "git",
"url": "https://github.com/milon/barcode.git",
"reference": "1f4031adb52146bb7fbe88ef42214011376f9cbe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/milon/barcode/zipball/1f4031adb52146bb7fbe88ef42214011376f9cbe",
"reference": "1f4031adb52146bb7fbe88ef42214011376f9cbe",
"shasum": ""
},
"require": {
"illuminate/support": "^7.0|^8.0|^9.0|^10.0 | ^11.0",
"php": "^7.3 | ^8.0"
},
"type": "library",
"extra": {
"laravel": {
"aliases": {
"DNS1D": "Milon\\Barcode\\Facades\\DNS1DFacade",
"DNS2D": "Milon\\Barcode\\Facades\\DNS2DFacade"
},
"providers": [
"Milon\\Barcode\\BarcodeServiceProvider"
]
}
},
"autoload": {
"psr-0": {
"Milon\\Barcode": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Nuruzzaman Milon",
"email": "contact@milon.im"
}
],
"description": "Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)",
"keywords": [
"CODABAR",
"CODE 128",
"CODE 39",
"barcode",
"datamatrix",
"ean",
"laravel",
"pdf417",
"qr code",
"qrcode"
],
"support": {
"issues": "https://github.com/milon/barcode/issues",
"source": "https://github.com/milon/barcode/tree/v11.0.0"
},
"funding": [
{
"url": "https://paypal.me/nuruzzamanmilon",
"type": "custom"
},
{
"url": "https://github.com/milon",
"type": "github"
}
],
"time": "2024-02-28T18:14:32+00:00"
},
{
"name": "monolog/monolog",
"version": "3.8.0",
"source": {
......
......@@ -24,7 +24,7 @@ public function up(): void
$table->string('patient_name', 32)->comment('问诊人姓名');
$table->integer('patient_age')->default(0)->comment('问诊人年龄');
$table->tinyInteger('patient_gender')->default(0)->comment('问诊人性别。[1=男性,2=女性,0=未知]');
$table->string('diagnosis_id',255)->nullable()->comment('诊断表ID');
$table->string('diagnosis_id', 255)->nullable()->comment('诊断表ID');
$table->string('diagnosis_name', 255)->nullable()->comment('诊断');
$table->text('inquiry_info')->comment('问诊问题');
......
......@@ -20,7 +20,7 @@ public function up(): void
$table->string('unit', 20)->nullable()->comment('单位');
$table->bigInteger('dosage_id')->nullable()->comment('用法用量表ID');
$table->string('batch_no', 64)->nullable()->comment('批次号');
$table->unique(['pharmacy_id', 'drug_id'], 'uk_pharmacyid_drugid');
$table->unique(['pharmacy_id', 'drug_id', 'deleted_at'], 'uk_pharmacyid_drugid_deletedat');
$table->timestamps();
$table->softDeletes();
......
......@@ -22,4 +22,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitdc518d1fd55a42b2a5b3d748a4dc1d94::getLoader();
return ComposerAutoloaderInitd80910c6b7b6c170f19efa978bbbffca::getLoader();
......@@ -74,8 +74,10 @@
'App\\Api\\Controllers\\PharmacistController' => $baseDir . '/app/Api/Controllers/PharmacistController.php',
'App\\Api\\Controllers\\PharmacyController' => $baseDir . '/app/Api/Controllers/PharmacyController.php',
'App\\Api\\Controllers\\PrescriptionController' => $baseDir . '/app/Api/Controllers/PrescriptionController.php',
'App\\Api\\Controllers\\SiteConfigController' => $baseDir . '/app/Api/Controllers/SiteConfigController.php',
'App\\Api\\Controllers\\UserController' => $baseDir . '/app/Api/Controllers/UserController.php',
'App\\Common\\Util' => $baseDir . '/app/Common/Util.php',
'App\\Console\\Commands\\InitPharmacyDrugCommand' => $baseDir . '/app/Console/Commands/InitPharmacyDrugCommand.php',
'App\\Console\\Commands\\PrescriptionCommand' => $baseDir . '/app/Console/Commands/PrescriptionCommand.php',
'App\\Console\\Kernel' => $baseDir . '/app/Console/Kernel.php',
'App\\Exceptions\\Handler' => $baseDir . '/app/Exceptions/Handler.php',
......@@ -83,6 +85,7 @@
'App\\Http\\Controllers\\Controller' => $baseDir . '/app/Http/Controllers/Controller.php',
'App\\Http\\Kernel' => $baseDir . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\Authenticate' => $baseDir . '/app/Http/Middleware/Authenticate.php',
'App\\Http\\Middleware\\CheckRoleChangeMiddleware' => $baseDir . '/app/Http/Middleware/CheckRoleChangeMiddleware.php',
'App\\Http\\Middleware\\EncryptCookies' => $baseDir . '/app/Http/Middleware/EncryptCookies.php',
'App\\Http\\Middleware\\PreventRequestsDuringMaintenance' => $baseDir . '/app/Http/Middleware/PreventRequestsDuringMaintenance.php',
'App\\Http\\Middleware\\RedirectIfAuthenticated' => $baseDir . '/app/Http/Middleware/RedirectIfAuthenticated.php',
......@@ -4960,6 +4963,20 @@
'League\\MimeTypeDetection\\GeneratedExtensionToMimeTypeMap' => $vendorDir . '/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php',
'League\\MimeTypeDetection\\MimeTypeDetector' => $vendorDir . '/league/mime-type-detection/src/MimeTypeDetector.php',
'League\\MimeTypeDetection\\OverridingExtensionToMimeTypeMap' => $vendorDir . '/league/mime-type-detection/src/OverridingExtensionToMimeTypeMap.php',
'Milon\\Barcode\\BarcodeServiceProvider' => $vendorDir . '/milon/barcode/src/Milon/Barcode/BarcodeServiceProvider.php',
'Milon\\Barcode\\DNS1D' => $vendorDir . '/milon/barcode/src/Milon/Barcode/DNS1D.php',
'Milon\\Barcode\\DNS2D' => $vendorDir . '/milon/barcode/src/Milon/Barcode/DNS2D.php',
'Milon\\Barcode\\Datamatrix' => $vendorDir . '/milon/barcode/src/Milon/Barcode/Datamatrix.php',
'Milon\\Barcode\\Facades\\DNS1DFacade' => $vendorDir . '/milon/barcode/src/Milon/Barcode/Facades/DNS1DFacade.php',
'Milon\\Barcode\\Facades\\DNS2DFacade' => $vendorDir . '/milon/barcode/src/Milon/Barcode/Facades/DNS2DFacade.php',
'Milon\\Barcode\\GS1_128\\AIData' => $vendorDir . '/milon/barcode/src/Milon/Barcode/GS1_128/AIData.php',
'Milon\\Barcode\\GS1_128\\GS1128' => $vendorDir . '/milon/barcode/src/Milon/Barcode/GS1_128/GS1128.php',
'Milon\\Barcode\\GS1_128\\Section' => $vendorDir . '/milon/barcode/src/Milon/Barcode/GS1_128/Section.php',
'Milon\\Barcode\\GS1_128\\SectionSlicer' => $vendorDir . '/milon/barcode/src/Milon/Barcode/GS1_128/SectionSlicer.php',
'Milon\\Barcode\\GS1_128\\Subsets' => $vendorDir . '/milon/barcode/src/Milon/Barcode/GS1_128/Subsets.php',
'Milon\\Barcode\\PDF417' => $vendorDir . '/milon/barcode/src/Milon/Barcode/PDF417.php',
'Milon\\Barcode\\QRcode' => $vendorDir . '/milon/barcode/src/Milon/Barcode/QRcode.php',
'Milon\\Barcode\\WrongCheckDigitException' => $vendorDir . '/milon/barcode/src/Milon/Barcode/WrongCheckDigitException.php',
'Mockery\\Adapter\\Phpunit\\MockeryPHPUnitIntegration' => $vendorDir . '/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php',
'Mockery\\Adapter\\Phpunit\\MockeryPHPUnitIntegrationAssertPostConditions' => $vendorDir . '/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditions.php',
'Mockery\\Adapter\\Phpunit\\MockeryTestCase' => $vendorDir . '/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php',
......@@ -7,5 +7,6 @@
return array(
'Pimple' => array($vendorDir . '/pimple/pimple/src'),
'Milon\\Barcode' => array($vendorDir . '/milon/barcode/src'),
'Barryvdh' => array($vendorDir . '/barryvdh/reflection-docblock/src'),
);
......@@ -60,7 +60,7 @@
'Psy\\' => array($vendorDir . '/psy/psysh/src'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
......
......@@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitdc518d1fd55a42b2a5b3d748a4dc1d94
class ComposerAutoloaderInitd80910c6b7b6c170f19efa978bbbffca
{
private static $loader;
......@@ -24,16 +24,16 @@ public static function getLoader()
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInitdc518d1fd55a42b2a5b3d748a4dc1d94', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitd80910c6b7b6c170f19efa978bbbffca', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitdc518d1fd55a42b2a5b3d748a4dc1d94', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitd80910c6b7b6c170f19efa978bbbffca', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitd80910c6b7b6c170f19efa978bbbffca::getInitializer($loader));
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94::$files;
$filesToLoad = \Composer\Autoload\ComposerStaticInitd80910c6b7b6c170f19efa978bbbffca::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
......
......@@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94
class ComposerStaticInitd80910c6b7b6c170f19efa978bbbffca
{
public static $files = array (
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
......@@ -466,8 +466,8 @@ class ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94
),
'Psr\\Http\\Message\\' =>
array (
0 => __DIR__ . '/..' . '/psr/http-factory/src',
1 => __DIR__ . '/..' . '/psr/http-message/src',
0 => __DIR__ . '/..' . '/psr/http-message/src',
1 => __DIR__ . '/..' . '/psr/http-factory/src',
),
'Psr\\Http\\Client\\' =>
array (
......@@ -780,6 +780,13 @@ class ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94
0 => __DIR__ . '/..' . '/pimple/pimple/src',
),
),
'M' =>
array (
'Milon\\Barcode' =>
array (
0 => __DIR__ . '/..' . '/milon/barcode/src',
),
),
'B' =>
array (
'Barryvdh' =>
......@@ -858,8 +865,10 @@ class ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94
'App\\Api\\Controllers\\PharmacistController' => __DIR__ . '/../..' . '/app/Api/Controllers/PharmacistController.php',
'App\\Api\\Controllers\\PharmacyController' => __DIR__ . '/../..' . '/app/Api/Controllers/PharmacyController.php',
'App\\Api\\Controllers\\PrescriptionController' => __DIR__ . '/../..' . '/app/Api/Controllers/PrescriptionController.php',
'App\\Api\\Controllers\\SiteConfigController' => __DIR__ . '/../..' . '/app/Api/Controllers/SiteConfigController.php',
'App\\Api\\Controllers\\UserController' => __DIR__ . '/../..' . '/app/Api/Controllers/UserController.php',
'App\\Common\\Util' => __DIR__ . '/../..' . '/app/Common/Util.php',
'App\\Console\\Commands\\InitPharmacyDrugCommand' => __DIR__ . '/../..' . '/app/Console/Commands/InitPharmacyDrugCommand.php',
'App\\Console\\Commands\\PrescriptionCommand' => __DIR__ . '/../..' . '/app/Console/Commands/PrescriptionCommand.php',
'App\\Console\\Kernel' => __DIR__ . '/../..' . '/app/Console/Kernel.php',
'App\\Exceptions\\Handler' => __DIR__ . '/../..' . '/app/Exceptions/Handler.php',
......@@ -867,6 +876,7 @@ class ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94
'App\\Http\\Controllers\\Controller' => __DIR__ . '/../..' . '/app/Http/Controllers/Controller.php',
'App\\Http\\Kernel' => __DIR__ . '/../..' . '/app/Http/Kernel.php',
'App\\Http\\Middleware\\Authenticate' => __DIR__ . '/../..' . '/app/Http/Middleware/Authenticate.php',
'App\\Http\\Middleware\\CheckRoleChangeMiddleware' => __DIR__ . '/../..' . '/app/Http/Middleware/CheckRoleChangeMiddleware.php',
'App\\Http\\Middleware\\EncryptCookies' => __DIR__ . '/../..' . '/app/Http/Middleware/EncryptCookies.php',
'App\\Http\\Middleware\\PreventRequestsDuringMaintenance' => __DIR__ . '/../..' . '/app/Http/Middleware/PreventRequestsDuringMaintenance.php',
'App\\Http\\Middleware\\RedirectIfAuthenticated' => __DIR__ . '/../..' . '/app/Http/Middleware/RedirectIfAuthenticated.php',
......@@ -5744,6 +5754,20 @@ class ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94
'League\\MimeTypeDetection\\GeneratedExtensionToMimeTypeMap' => __DIR__ . '/..' . '/league/mime-type-detection/src/GeneratedExtensionToMimeTypeMap.php',
'League\\MimeTypeDetection\\MimeTypeDetector' => __DIR__ . '/..' . '/league/mime-type-detection/src/MimeTypeDetector.php',
'League\\MimeTypeDetection\\OverridingExtensionToMimeTypeMap' => __DIR__ . '/..' . '/league/mime-type-detection/src/OverridingExtensionToMimeTypeMap.php',
'Milon\\Barcode\\BarcodeServiceProvider' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/BarcodeServiceProvider.php',
'Milon\\Barcode\\DNS1D' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/DNS1D.php',
'Milon\\Barcode\\DNS2D' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/DNS2D.php',
'Milon\\Barcode\\Datamatrix' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/Datamatrix.php',
'Milon\\Barcode\\Facades\\DNS1DFacade' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/Facades/DNS1DFacade.php',
'Milon\\Barcode\\Facades\\DNS2DFacade' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/Facades/DNS2DFacade.php',
'Milon\\Barcode\\GS1_128\\AIData' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/GS1_128/AIData.php',
'Milon\\Barcode\\GS1_128\\GS1128' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/GS1_128/GS1128.php',
'Milon\\Barcode\\GS1_128\\Section' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/GS1_128/Section.php',
'Milon\\Barcode\\GS1_128\\SectionSlicer' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/GS1_128/SectionSlicer.php',
'Milon\\Barcode\\GS1_128\\Subsets' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/GS1_128/Subsets.php',
'Milon\\Barcode\\PDF417' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/PDF417.php',
'Milon\\Barcode\\QRcode' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/QRcode.php',
'Milon\\Barcode\\WrongCheckDigitException' => __DIR__ . '/..' . '/milon/barcode/src/Milon/Barcode/WrongCheckDigitException.php',
'Mockery\\Adapter\\Phpunit\\MockeryPHPUnitIntegration' => __DIR__ . '/..' . '/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegration.php',
'Mockery\\Adapter\\Phpunit\\MockeryPHPUnitIntegrationAssertPostConditions' => __DIR__ . '/..' . '/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryPHPUnitIntegrationAssertPostConditions.php',
'Mockery\\Adapter\\Phpunit\\MockeryTestCase' => __DIR__ . '/..' . '/mockery/mockery/library/Mockery/Adapter/Phpunit/MockeryTestCase.php',
......@@ -10181,10 +10205,10 @@ class ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94::$prefixesPsr0;
$loader->classMap = ComposerStaticInitdc518d1fd55a42b2a5b3d748a4dc1d94::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInitd80910c6b7b6c170f19efa978bbbffca::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitd80910c6b7b6c170f19efa978bbbffca::$prefixDirsPsr4;
$loader->prefixesPsr0 = ComposerStaticInitd80910c6b7b6c170f19efa978bbbffca::$prefixesPsr0;
$loader->classMap = ComposerStaticInitd80910c6b7b6c170f19efa978bbbffca::$classMap;
}, null, ClassLoader::class);
}
......@@ -3914,6 +3914,83 @@
"install-path": "../league/mime-type-detection"
},
{
"name": "milon/barcode",
"version": "v11.0.0",
"version_normalized": "11.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/milon/barcode.git",
"reference": "1f4031adb52146bb7fbe88ef42214011376f9cbe"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/milon/barcode/zipball/1f4031adb52146bb7fbe88ef42214011376f9cbe",
"reference": "1f4031adb52146bb7fbe88ef42214011376f9cbe",
"shasum": ""
},
"require": {
"illuminate/support": "^7.0|^8.0|^9.0|^10.0 | ^11.0",
"php": "^7.3 | ^8.0"
},
"time": "2024-02-28T18:14:32+00:00",
"type": "library",
"extra": {
"laravel": {
"aliases": {
"DNS1D": "Milon\\Barcode\\Facades\\DNS1DFacade",
"DNS2D": "Milon\\Barcode\\Facades\\DNS2DFacade"
},
"providers": [
"Milon\\Barcode\\BarcodeServiceProvider"
]
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Milon\\Barcode": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Nuruzzaman Milon",
"email": "contact@milon.im"
}
],
"description": "Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)",
"keywords": [
"CODABAR",
"CODE 128",
"CODE 39",
"barcode",
"datamatrix",
"ean",
"laravel",
"pdf417",
"qr code",
"qrcode"
],
"support": {
"issues": "https://github.com/milon/barcode/issues",
"source": "https://github.com/milon/barcode/tree/v11.0.0"
},
"funding": [
{
"url": "https://paypal.me/nuruzzamanmilon",
"type": "custom"
},
{
"url": "https://github.com/milon",
"type": "github"
}
],
"install-path": "../milon/barcode"
},
{
"name": "mockery/mockery",
"version": "1.6.12",
"version_normalized": "1.6.12.0",
......
<?php return array(
'root' => array(
'name' => 'laravel/laravel',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'cc9e5a720b59740666eef1f99eeacdd1783644f7',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '1ce170d021ead062ce1bfea77490b4db625f5d4f',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
......@@ -560,9 +560,9 @@
'dev_requirement' => false,
),
'laravel/laravel' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'cc9e5a720b59740666eef1f99eeacdd1783644f7',
'pretty_version' => 'dev-develop',
'version' => 'dev-develop',
'reference' => '1ce170d021ead062ce1bfea77490b4db625f5d4f',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
......@@ -685,6 +685,15 @@
'aliases' => array(),
'dev_requirement' => false,
),
'milon/barcode' => array(
'pretty_version' => 'v11.0.0',
'version' => '11.0.0.0',
'reference' => '1f4031adb52146bb7fbe88ef42214011376f9cbe',
'type' => 'library',
'install_path' => __DIR__ . '/../milon/barcode',
'aliases' => array(),
'dev_requirement' => false,
),
'mockery/mockery' => array(
'pretty_version' => '1.6.12',
'version' => '1.6.12.0',
......@@ -1105,8 +1114,8 @@
'psr/log-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '3.0.0',
1 => '1.0|2.0|3.0',
0 => '1.0|2.0|3.0',
1 => '3.0.0',
),
),
'psr/simple-cache' => array(
......
{
"name": "codemirror",
"version": "5.0.0",
"version":"5.0.0",
"main": "lib/codemirror.js",
"description": "In-browser code editing made bearable",
"licenses": [
{
"type": "MIT",
"url": "http://codemirror.net/LICENSE"
}
],
"directories": {
"lib": "./lib"
},
"scripts": {
"test": "node ./test/run.js"
},
"devDependencies": {
"blint": ">=0.1.1",
"node-static": "0.6.0",
"phantomjs": "1.9.2-5"
},
"licenses": [{"type": "MIT",
"url": "http://codemirror.net/LICENSE"}],
"directories": {"lib": "./lib"},
"scripts": {"test": "node ./test/run.js"},
"devDependencies": {"node-static": "0.6.0",
"phantomjs": "1.9.2-5",
"blint": ">=0.1.1"},
"bugs": "http://github.com/codemirror/CodeMirror/issues",
"keywords": [
"JavaScript",
"CodeMirror",
"Editor"
],
"keywords": ["JavaScript", "CodeMirror", "Editor"],
"homepage": "http://codemirror.net",
"maintainers": [
{
"name": "Marijn Haverbeke",
"maintainers":[{"name": "Marijn Haverbeke",
"email": "marijnh@gmail.com",
"web": "http://marijnhaverbeke.nl"
}
],
"repository": {
"type": "git",
"url": "https://github.com/codemirror/CodeMirror.git"
},
"dependencies": {
"codemirror": "file:"
}
"web": "http://marijnhaverbeke.nl"}],
"repository": {"type": "git",
"url": "https://github.com/codemirror/CodeMirror.git"}
}
......@@ -38,8 +38,5 @@
"gulp-ruby-sass": "^1.0.1",
"gulp-uglifyjs": "^0.6.1",
"gulp-util": "^3.0.1"
},
"dependencies": {
"editor.md": "file:"
}
}
{
"name": "codemirror",
"version": "5.0.0",
"version":"5.0.0",
"main": "lib/codemirror.js",
"description": "In-browser code editing made bearable",
"licenses": [
{
"type": "MIT",
"url": "http://codemirror.net/LICENSE"
}
],
"directories": {
"lib": "./lib"
},
"scripts": {
"test": "node ./test/run.js"
},
"devDependencies": {
"blint": ">=0.1.1",
"node-static": "0.6.0",
"phantomjs": "1.9.2-5"
},
"licenses": [{"type": "MIT",
"url": "http://codemirror.net/LICENSE"}],
"directories": {"lib": "./lib"},
"scripts": {"test": "node ./test/run.js"},
"devDependencies": {"node-static": "0.6.0",
"phantomjs": "1.9.2-5",
"blint": ">=0.1.1"},
"bugs": "http://github.com/codemirror/CodeMirror/issues",
"keywords": [
"JavaScript",
"CodeMirror",
"Editor"
],
"keywords": ["JavaScript", "CodeMirror", "Editor"],
"homepage": "http://codemirror.net",
"maintainers": [
{
"name": "Marijn Haverbeke",
"maintainers":[{"name": "Marijn Haverbeke",
"email": "marijnh@gmail.com",
"web": "http://marijnhaverbeke.nl"
}
],
"repository": {
"type": "git",
"url": "https://github.com/codemirror/CodeMirror.git"
},
"dependencies": {
"codemirror": "file:"
}
"web": "http://marijnhaverbeke.nl"}],
"repository": {"type": "git",
"url": "https://github.com/codemirror/CodeMirror.git"}
}
......@@ -38,8 +38,5 @@
"gulp-ruby-sass": "^1.0.1",
"gulp-uglifyjs": "^0.6.1",
"gulp-util": "^3.0.1"
},
"dependencies": {
"editor.md": "file:"
}
}
{
"name": "milon/barcode",
"description": "Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)",
"keywords": [
"barcode",
"laravel",
"qrcode",
"QR Code",
"PDF417",
"Datamatrix",
"CODE 39",
"CODE 128",
"EAN",
"CODABAR"
],
"license": "LGPL-3.0",
"authors": [
{
"name": "Nuruzzaman Milon",
"email": "contact@milon.im"
}
],
"require": {
"php": "^7.3 | ^8.0",
"illuminate/support": "^7.0|^8.0|^9.0|^10.0 | ^11.0"
},
"autoload": {
"psr-0": {
"Milon\\Barcode": "src/"
}
},
"minimum-stability": "stable",
"config": {
"sort-packages": true
},
"extra": {
"laravel": {
"providers": [
"Milon\\Barcode\\BarcodeServiceProvider"
],
"aliases": {
"DNS1D": "Milon\\Barcode\\Facades\\DNS1DFacade",
"DNS2D": "Milon\\Barcode\\Facades\\DNS2DFacade"
}
}
}
}
[![Packagist Downloads](https://img.shields.io/packagist/dt/milon/barcode.svg)](https://packagist.org/packages/milon/barcode) [![Stable version](https://img.shields.io/packagist/v/milon/barcode.svg)](https://packagist.org/packages/milon/barcode) [![License](https://img.shields.io/packagist/l/milon/barcode.svg)](https://packagist.org/packages/milon/barcode)
This is a barcode generation package inspired by <https://github.com/tecnickcom/TCPDF>. Actually, I use that package's underline classes for generating barcodes. This package is just a wrapper of that package and adds compatibility with Laravel 5.
I used the following classes of that package.
- src/Milon/Barcode/Datamatrix.php (include/barcodes/datamatrix.php)
- src/Milon/Barcode/DNS1D.php (tcpdf_barcodes_1d.php)
- src/Milon/Barcode/DNS2D.php (tcpdf_barcodes_2d.php)
- src/Milon/Barcode/PDF417.php (include/barcodes/pdf417.php)
- src/Milon/Barcode/QRcode.php (include/barcodes/qrcode.php)
[Read More on TCPDF website](http://www.tcpdf.org)
# This package is compatible with Laravel `4.*` , `5.*`, `6.*`, `7.*`, `8.*`, `9.*` and `10.*`
This package relies on [php-gd](http://php.net/manual/en/book.image.php) extension. So, make sure it is installed on your machine.
## Installation
Begin by installing this package through Composer. Just run following command to terminal-
```shell script
composer require milon/barcode
```
You can also edit your project's `composer.json` file to require `milon/barcode`.
```json
"require": {
"milon/barcode": "^9.0"
}
```
For Laravel 8.* use this-
```json
"require": {
"milon/barcode": "^8.0"
}
```
For Laravel 7.* use this-
```json
"require": {
"milon/barcode": "^7.0"
}
```
For Laravel 6.* use this-
```json
"require": {
"milon/barcode": "^6.0"
}
```
For Laravel 5.0 and 5.1 use this-
```json
"require": {
"milon/barcode": "^5.1"
}
```
For Laravel 4.0, 4.1 and 4.2 use this-
```json
"require": {
"milon/barcode": "^4.2"
}
```
Next, update Composer from the Terminal:
```shell script
composer update
```
Once this operation completes, the final step is to add the service provider. Open `config/app.php`, and add a new item to the providers array.
```php
'providers' => [
// ...
Milon\Barcode\BarcodeServiceProvider::class,
]
```
For version 4.* add these lines on `app/config/app.php` file-
```php
'providers' => array(
// ...
'Milon\Barcode\BarcodeServiceProvider',
)
```
If you want to change Bar-code's settings (Store Path etc.), you need to publish its config file(s). For that you need to run in the terminal-
```shell script
# Laravel 5.x
php artisan vendor:publish
# Laravel 4.x
php artisan config:publish milon/barcode
```
Make sure you have write permission to the storage path. By default it sets to `/storage` folder.
Now add the alias.
```php
'aliases' => [
// ...
'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
]
```
For version 4.2 alias will be like this-
```php
'aliases' => array(
// ...
'DNS1D' => 'Milon\Barcode\Facades\DNS1DFacade',
'DNS2D' => 'Milon\Barcode\Facades\DNS2DFacade',
)
```
Bar-code generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)
generator in html, png , jpeg embedded base64 code and SVG canvas
```php
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T');
echo '<img src="data:image/png,' . DNS1D::getBarcodePNG('4', 'C39+') . '" alt="barcode" />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T');
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+') . '" alt="barcode" />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T');
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+') . '" alt="barcode" />';
```
```php
echo DNS1D::getBarcodeSVG('4445645656', 'C39');
echo DNS2D::getBarcodeHTML('4445645656', 'QRCODE');
echo DNS2D::getBarcodePNGPath('4445645656', 'PDF417');
echo DNS2D::getBarcodeSVG('4445645656', 'DATAMATRIX');
echo '<img src="data:image/png;base64,' . DNS2D::getBarcodePNG('4', 'PDF417') . '" alt="barcode" />';
```
## Width and Height example
```php
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33);
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33);
echo '<img src="' . DNS1D::getBarcodePNG('4', 'C39+',3,33) . '" alt="barcode" />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33);
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+',3,33) . '" alt="barcode" />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33);
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+',3,33) . '" alt="barcode" />';
```
## Color
```php
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33,'green');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33,'green');
echo '<img src="' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1)) . '" alt="barcode" />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1)) . '" alt="barcode" />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+',3,33,array(1,1,1)) . '" alt="barcode" />';
```
## Show Text
```php
echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33,'green', true);
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33,'green', true);
echo '<img src="' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1), true) . '" alt="barcode" />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0), true);
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1), true) . '" alt="barcode" />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0), true);
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+',3,33,array(1,1,1), true) . '" alt="barcode" />';
```
## 2D Barcodes
```php
echo DNS2D::getBarcodeHTML('4445645656', 'QRCODE');
echo DNS2D::getBarcodePNGPath('4445645656', 'PDF417');
echo DNS2D::getBarcodeSVG('4445645656', 'DATAMATRIX');
```
## 1D Barcodes
```php
echo DNS1D::getBarcodeHTML('4445645656', 'C39');
echo DNS1D::getBarcodeHTML('4445645656', 'C39+');
echo DNS1D::getBarcodeHTML('4445645656', 'C39E');
echo DNS1D::getBarcodeHTML('4445645656', 'C39E+');
echo DNS1D::getBarcodeHTML('4445645656', 'C93');
echo DNS1D::getBarcodeHTML('4445645656', 'S25');
echo DNS1D::getBarcodeHTML('4445645656', 'S25+');
echo DNS1D::getBarcodeHTML('4445645656', 'I25');
echo DNS1D::getBarcodeHTML('4445645656', 'I25+');
echo DNS1D::getBarcodeHTML('4445645656', 'C128');
echo DNS1D::getBarcodeHTML('4445645656', 'C128A');
echo DNS1D::getBarcodeHTML('4445645656', 'C128B');
echo DNS1D::getBarcodeHTML('4445645656', 'C128C');
echo DNS1D::getBarcodeHTML('4445645656', 'GS1-128');
echo DNS1D::getBarcodeHTML('44455656', 'EAN2');
echo DNS1D::getBarcodeHTML('4445656', 'EAN5');
echo DNS1D::getBarcodeHTML('4445', 'EAN8');
echo DNS1D::getBarcodeHTML('4445', 'EAN13');
echo DNS1D::getBarcodeHTML('4445645656', 'UPCA');
echo DNS1D::getBarcodeHTML('4445645656', 'UPCE');
echo DNS1D::getBarcodeHTML('4445645656', 'MSI');
echo DNS1D::getBarcodeHTML('4445645656', 'MSI+');
echo DNS1D::getBarcodeHTML('4445645656', 'POSTNET');
echo DNS1D::getBarcodeHTML('4445645656', 'PLANET');
echo DNS1D::getBarcodeHTML('4445645656', 'RMS4CC');
echo DNS1D::getBarcodeHTML('4445645656', 'KIX');
echo DNS1D::getBarcodeHTML('4445645656', 'IMB');
echo DNS1D::getBarcodeHTML('4445645656', 'CODABAR');
echo DNS1D::getBarcodeHTML('4445645656', 'CODE11');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T');
```
# Running without Laravel
You can use this library without using Laravel.
Example:
```php
use \Milon\Barcode\DNS1D;
$d = new DNS1D();
$d->setStorPath(__DIR__.'/cache/');
echo $d->getBarcodeHTML('9780691147727', 'EAN13');
```
## License
This package is published under `GNU LGPLv3` license and copyright to [Nuruzzaman Milon](http://milon.im). Original Barcode generation classes were written by Nicola Asuni. The license agreement is on project's root.
### [Buy me a coffee ☕](https://paypal.me/tomilon?locale.x=en_US)
License: GNU LGPLv3<br>
Package Author: [Nuruzzaman Milon](http://milon.im)<br>
Original Barcode Class Author: [Nicola Asuni](http://www.tcpdf.org)<br>
Package Copyright: Nuruzzaman Milon<br>
Barcode Generation Class Copyright:<br>
Nicola Asuni<br>
Tecnick.com LTD<br>
www.tecnick.com
<?php
namespace Milon\Barcode;
use Illuminate\Support\ServiceProvider;
class BarcodeServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Publish asset
*/
public function boot() {
$this->publishes([
__DIR__.'/../../config/config.php' => config_path('barcode.php'),
]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register() {
$this->app->singleton('DNS1D', function() {
return new DNS1D;
});
$this->app->singleton('DNS2D', function() {
return new DNS2D;
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides() {
return array("DNS1D", "DNS2D");
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
namespace Milon\Barcode\Facades;
use Illuminate\Support\Facades\Facade;
/**
* @method static string getBarcodeSVG(string $code, string $type, int|float $w = 2, int|float $h = 30, string $color = 'black', bool $showCode = true, bool $inline = false)
* @method static string getBarcodeHTML(string $code, string $type, int|float $w = 2, int|float $h = 30, string $color = 'black', bool $showCode = false)
* @method static string|false getBarcodePNG(string $code, string $type, int|float $w = 2, int|float $h = 30, array $color = [0, 0, 0], bool $showCode = false)
* @method static string|false getBarcodePNGPath(string $code, string $type, int|float $w = 2, int|float $h = 30, array $color = [0, 0, 0], bool $showCode = false)
* @method static \Illuminate\Contracts\Routing\UrlGenerator|string getBarcodePNGUri(string $code, string $type, int|float $w = 2, int|float $h = 30, array $color = [0, 0, 0])
*/
class DNS1DFacade extends Facade {
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'DNS1D';
}
}
<?php
namespace Milon\Barcode\Facades;
use Illuminate\Support\Facades\Facade;
/**
* @method static string getBarcodeSVG(string $code, string $type, int $w = 3, int $h = 3, string $color = 'black')
* @method static string getBarcodeHTML(string $code, string $type, int $w = 10, int $h = 10, string $color = 'black')
* @method static string|false getBarcodePNG(string $code, string $type, int $w = 3, int $h = 3, array $color = [0, 0, 0],)
* @method static string|false getBarcodePNGPath(string $code, string $type, int $w = 2, int $h = 30, array $color = [0, 0, 0])
* @method static \Milon\Barcode\DNS2D setStorPath(string $path)
*/
class DNS2DFacade extends Facade
{
/**
* Get the registered name of the component.
*
* @return string
*/
protected static function getFacadeAccessor()
{
return 'DNS2D';
}
}
<?php
namespace Milon\Barcode\GS1_128;
use Ayeo\Barcode\Data\BinaryMap;
/**
* @class
* @description Generate GS1_128 format
* @link https://www.gs1-128.info/
* */
class GS1128
{
/**
* @var SectionSlicer
*/
private $slicer;
private $currentSubset;
/**
* @var Subsets
*/
private $subsets;
private $binaryCodeOffsets = [];
public function __construct()
{
$this->slicer = new SectionSlicer();
$this->subsets = new Subsets();
$this->currentSubset = $this->subsets->getSubsetSefault();
}
public function generate($barcodeString)
{
$this->binaryCodeOffsets = [];
$this->binaryCodeOffsets[] = 105; //start
$this->binaryCodeOffsets[] = 102; //fcn1
$sections = $this->slicer->getSections($barcodeString);
$totalSectionsNumber = count($sections);
$i = 1;
/* @var $section Section */
foreach ($sections as $section) {
$this->doShit($this->getPairs((string) $section), $barcodeString);
if ($i++ < $totalSectionsNumber && $section->hasFixedLength() === false) {
$this->binaryCodeOffsets[] = 102; //fcn1
}
}
$this->binaryCodeOffsets[] = $this->generateChecksum($this->binaryCodeOffsets);
$this->binaryCodeOffsets[] = 106; // STOP
$this->binaryCodeOffsets[] = 107; // TERMINATE
return array_map(function($i) { return (int) $i; }, $this->binaryCodeOffsets);
}
/**
* @param $letter
* @param $pair
* @return bool
*/
private function setProperSubset($letter, $pair)
{
if (array_search((string) $pair, $this->getSubsetMap($letter), true)) {
$this->currentSubset = $letter;
$this->binaryCodeOffsets[] = $this->subsets->getAllSubset()[$letter];
return true;
}
return false;
}
/**
* @param $pair
* @param $fullCode
*/
private function checkSubsetMap($pair, $fullCode)
{
if (array_search((string) $pair, $this->getCurrentSubset(), true)) {
return;
}
foreach (array_keys($this->subsets->getAllSubset()) as $letter) {
if ($this->setProperSubset($letter, $pair)) {
return;
}
}
}
/**
* @param $array
* @return string (binary)
*/
private function generateChecksum($array)
{
$total = 0;
foreach ($array as $i => $value) {
$multiplier = $i === 0 ? 1 : $i;
$total += $value * $multiplier;
}
return $total % 103;
}
/**
* @param $array
* @param $fullCode
*/
private function doShit($array, $fullCode)
{
foreach ($array as $pair) {
$this->checkSubsetMap($pair, $fullCode);
$key = array_search($pair, $this->getCurrentSubset(), true);
$key === false ? $this->doShit(str_split($pair), $fullCode) : $this->binaryCodeOffsets[] = $key;
}
}
/**
* @param $code
* @return array
*/
private function getPairs($code)
{
return str_split($code, 2);
}
/**
* @return array
*/
private function getCurrentSubset()
{
return $this->getSubsetMap($this->currentSubset);
}
private function getSubsetMap($letter)
{
return $this->subsets->get($letter);
}
}
<?php
namespace Milon\Barcode\GS1_128;
use JsonSerializable;
class Section implements JsonSerializable
{
/**
* @var string
*/
private $identifier;
/**
* @var strings
*/
private $value;
private $fixedLength = false;
/**
* @param string $identifier
* @param string $value
*/
public function __construct($identifier, $value, $fixedLength = false)
{
$this->fixedLength = (bool) $fixedLength;
$this->identifier = $identifier;
$this->value = $value;
}
public function hasFixedLength()
{
return $this->fixedLength;
}
function jsonSerialize()
{
return [$this->identifier, $this->value];
}
public function __toString()
{
return sprintf('%s%s', $this->identifier, $this->value);
}
}
<?php
namespace Milon\Barcode\GS1_128;
class SectionSlicer
{
public function getSections($data)
{
$pattern = '#\((\d+)\)((?:[^\(])+)#';
preg_match_all($pattern, $data, $matches);
$result = [];
for ($x = 0; $x < count($matches[0]); $x++) {
$result[] = $matches[1][$x];
$result[] = $matches[2][$x];
}
$expected = [];
foreach (array_chunk($result, 2) as $sectionData) {
$expected[] = $this->build($sectionData[0], $sectionData[1]);
}
return $expected;
}
public function build($identifier, $value)
{
if (array_key_exists($identifier, AIData::$default) === false) {
throw new \LogicException(sprintf('Unknown application identifier %s', $identifier));
}
[$minLength, $maxLength, $description] = AIData::$default[$identifier];
if (strlen($value) < $minLength || strlen($value) > $maxLength) {
throw new \LogicException($description);
}
$fixedLength = $minLength === $maxLength;
return new Section($identifier, $value, $fixedLength);
}
}
<?php
namespace Milon\Barcode\GS1_128;
class Subsets
{
private $subsets = [
'C' => 99,
'B' => 100,
'A' => 101,
];
private $mapA = [
' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', // 9
'*', '+', ',', '-', '.', '/', '0', '1', '2', '3', // 19
'4', '5', '6', '7', '8', '9', ':', ';', '<', '=', // 29
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', // 39
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', // 49
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', // 59
'\\', ']', '^', '_', // 63
"\x00", "\x01", "\x02", "\x03", "\x04", "\x05", // 69
"\x06", "\x07", "\x08", "\x09", "\x0A", "\x0B", // 75
"\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11", // 81
"\x12", "\x13", "\x14", "\x15", "\x16", "\x17", // 87
"\x18", "\x19", "\x1A", "\x1B", "\x1C", "\x1D", // 93
"\x1E", "\x1F", // 95
'FNC_3', 'FNC_2', 'SHIFT_B', 'CODE_C', 'CODE_B', // 100
'FNC_4', 'FNC_1', 'START_A', 'START_B', 'START_C', // 105
'STOP', // 106
];
private $mapB = [
' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', // 9
'*', '+', ',', '-', '.', '/', '0', '1', '2', '3', // 19
'4', '5', '6', '7', '8', '9', ':', ';', '<', '=', // 29
'>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', // 39
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', // 49
'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', // 59
'\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e', // 69
'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', // 79
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', // 89
'z', '{', '|', '}', '~', "\x7F", // 95
'FNC_3', 'FNC_2', 'SHIFT_A', 'CODE_C', 'FNC_4', // 100
'CODE_A', 'FNC_1', 'START_A', 'START_B', 'START_C', // 105
'STOP', // 106
];
//C generates the shortest code
private $mapC = [
"00","01","02","03","04","05","06","07","08","09",
"10","11","12","13","14","15","16","17","18","19",
"20","21","22","23","24","25","26","27","28","29",
"30","31","32","33","34","35","36","37","38","39",
"40","41","42","43","44","45","46","47","48","49",
"50","51","52","53","54","55","56","57","58","59",
"60","61","62","63","64","65","66","67","68","69",
"70","71","72","73","74","75","76","77","78","79",
"80","81","82","83","84","85","86","87","88","89",
"90","91","92","93","94","95","96","97","98","99"
];
public function getSubsetSefault()
{
//C generates the shortest code
return 'C';
}
public function getAllSubset()
{
return $this->subsets;
}
public function get($code)
{
return $this->{"map$code"} ?? $this->mapC;
}
}
<?php
namespace Milon\Barcode;
use Exception;
class WrongCheckDigitException extends \LogicException {
/**
* WrongCheckDigitException constructor.
* @param int|null $actual
* @param int|null $expected
* @param Exception $code
* @param Exception|NULL $previous
*/
public function __construct($actual = NULL, $expected = NULL, $code = 0, \Exception $previous = NULL) {
$message = NULL;
if ($actual && $expected) {
$message = 'Expected ' . $expected . ' get ' . $actual;
}
parent::__construct($message, $code, $previous);
}
}
\ No newline at end of file
<?php
return [
'store_path' => public_path("/"),
];
<?php
/*
|--------------------------------------------------------------------------
| Milon/Barcode Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/barcodes', function() {
return "barcodes";
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment