laymont / shicontstand
:package_description
Requires
- php: ^8.0
- illuminate/contracts: ^9.39
- illuminate/support: ^9.39
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^6.3
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.11
- pestphp/pest: ^1.22
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.9
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-20 11:13:16 UTC
README
本包的目的是实现ISO 6346标准,该标准涵盖了用于多式联运货物运输的容器的编码、标识和标记。该标准为每个容器建立了一个视觉识别系统,包括一个独特的序列号(带校验位)、所有者、国家代码、尺寸、类型和设备类别以及任何操作标记。
查看contributing.md以查看待办事项列表。
安装
通过Composer
composer require laymont/shicontstand
使用以下命令发布配置文件
php artisan vendor:publish --tag="shicontstand-config"
这是发布配置文件的内容
- 在运行迁移之前,您可以在下一个数组中的表部分更改表名
- 定义您的模型中存储容器号码的属性名称,同时也定义存储容器ISO代码的属性
<?php return [ /** * The equipment category identifier consists of one of the following capital letters of the Latin alphabet */ 'equipment_category_identifier' => [ ['u' => 'for all freight containers'], ['J' => 'for detachable freight container-related equipment'], ['Z' => 'for trailers and chassis'], ], /** * An equivalent numerical value is assigned to each letter of the alphabet, * beginning with 10 for the letter A (11 and multiples thereof are omitted) */ 'calculation_step_one' => [ ['character' => 'A', 'value' => 10], ['character' => 'B', 'value' => 12], ['character' => 'C', 'value' => 13], ['character' => 'D', 'value' => 14], ['character' => 'E', 'value' => 15], ['character' => 'F', 'value' => 16], ['character' => 'G', 'value' => 17], ['character' => 'H', 'value' => 18], ['character' => 'I', 'value' => 19], ['character' => 'J', 'value' => 20], ['character' => 'K', 'value' => 21], ['character' => 'L', 'value' => 23], ['character' => 'M', 'value' => 24], ['character' => 'N', 'value' => 25], ['character' => 'O', 'value' => 26], ['character' => 'P', 'value' => 27], ['character' => 'Q', 'value' => 28], ['character' => 'R', 'value' => 29], ['character' => 'S', 'value' => 30], ['character' => 'T', 'value' => 31], ['character' => 'U', 'value' => 32], ['character' => 'V', 'value' => 34], ['character' => 'W', 'value' => 35], ['character' => 'X', 'value' => 36], ['character' => 'Y', 'value' => 37], ['character' => 'Z', 'value' => 38], ], /** * Each of the numbers calculated in step 1 is multiplied by 2position, where position is the exponent to base 2. * Position starts at 0, from left to right. * The following table shows the multiplication factors */ 'calculation_step_two' => [1, 2, 4, 8, 16, 32, 64, 128, 256, 512], /** * table names */ 'tables' => [ 'type_groups' => 'scs_type_groups', 'size_types' => 'scs_size_types', 'length_codes' => 'scs_length_codes', 'size_codes' => 'scs_size_codes', 'type_codes' => 'scs_type_codes', ], /** * Container Model name */ 'model' => [ 'name' => 'containers', 'property' => 'number', ], /** * Route Configuration */ 'prefix' => 'scs', 'middleware' => ['web'], ]; ?>
使用以下命令发布和运行迁移
php artisan vendor:publis --tag="shicontstand-migrations"
迁移完成后发布种子文件
php artisan vendor:publis --tag="shicontstand-seeders"
运行种子文件
php artisan db:seed --class=ShicontstandSeeder
建议更新路由缓存
php artisan route:cache
使用方法
在您的容器模型中添加以下特质
use Laymont\Shicontstand\Http\Traits\ScsAttributeTrait; class Container extends Model { use ScsAttributeTrait; ... }
现在当您的模型响应时,将有一个新的属性,称为scs
{ "id": 21, "number": "TLLU8328970", "iso_type": null, "created_at": null, "updated_at": null, "scs": { "is_container": true, "owner": "TLL", "category": "U", "serial": "832897", "digit_validations": { "is_valid": true, "digit_validator": 0 } } }
Shicontstand门面
Shicontstand::getTypeGroups();
Shicontstand::getTypeGroup($code);
Shicontstand::getSizeTypes();
Shicontstand::getSizeType($code);
Shicontstand::getLengthCodes();
Shicontstand::getLengthCode($code);
Shicontstand::getSizeCodes();
Shicontstand::getSizeCode($code);
Shicontstand::getTypeCodes();
Shicontstand::getTypeCode($code);
变更日志
请参阅changelog以获取最近更改的更多信息。
测试
$ composer test
贡献
请参阅contributing.md以获取详细信息及待办事项列表。
安全
如果您发现任何与安全相关的问题,请通过laymont@gmail.com发送电子邮件,而不是使用问题跟踪器。
鸣谢
- Laymont Arratia
- [所有贡献者][link-contributors]
许可证
MIT。请参阅许可证文件以获取更多信息。