rabsana/normalizer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rabsana/normalizer

最新稳定版本:v2.0.0

Composer 安装命令:

composer require rabsana/normalizer

包简介

Normalize values based on predefined normalizing table

README 文档

README

rabsana/normalizer normalizes values, amounts, prices based on predefined list of ratios.

Installation

Add following code to your project composer.json file(ensure token not expired):

{
  "repositories": [
        {
          "type": "vcs",
          "url": "https://gitlab+deploy-token-totalexcoin:W3tDVLHJxg4uNtEsjtWi@repo.rabsana.ir/packages/normalizer.git"
        }
    ]
}

Install via composer in the root directory of a Laravel 5 application

composer require rabsana/normalizer:dev-master

Add the following line to config/app.php inside the 'providers' array to use the service provider

'Rabsana\Normalizer\ServiceProvider',

Update composer

composer update

Run the package install command

php artisan vendor:publish

Usage

For accessing normalization features you only need to add NormalizerTrait to your model:

use Rabsana\Normalizer\Traits\NormalizerTrait;

class YourModelName extends Model{
    use NormalizerTrait;
}

This trait adds following methods to the model:

  • normalizers() Which is a morphMany relationship to Rabsana\Normalizer\Models\Normalizer::class class.
  • normalize() This method will normalize given column using value based on normalizing table.

Overview

$normalizations

this property should be presents in models in order to normalizations can work.

public static $normalizations = [
    'column' => 'representedName',
];

Configs

After publishing configs there will be a rabsana-normalizer.php file in config/ folder

return [
    // These middlewares will be applied to all actions of controllers
    'middlewares' => [
        'web',
        'auth'
    ],

    'views' => [
        'master-layout' => 'rabsana-normalizer::layouts.master',
        'content-section' => 'content',
        'scripts-stack' => 'scripts',
        'styles-stack' => 'styles',
    ],

    // Represents classes that use NormalizerTrait
    'templates' => [
        [
            'class' => 'Rabsana\Normalizer\Tests\Models\Foo',
            'name' => 'localized name'
        ]
    ],
];
  • You have to add middleware for restricting access to specific group of uses(e.g admins)
  • You should specify master layout and main section of page. Also you should specify styles and scripts stacks
  • Each class tha you want to be used in normalizations, you must add them in templates section.

Tools

composer, phpunit, orchestra/testbench

License

This packaged licensed to https://rabsana.ir

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-08-31