2017 © Pedro Peláez
 

yii2-extension yii2-consumption-module

consumption

image

halumein/yii2-consumption-module

consumption

  • Saturday, June 3, 2017
  • by halumein
  • Repository
  • 3 Watchers
  • 1 Stars
  • 89 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Yii2-consumption-module

php composer require halumein/yii2-consumption-module "*"

миграции:, (*1)

php yii migrate --migrationPath=vendor/halumein/yii2-consumption-module/migrations

В конфигурационный файл приложения добавить модуль consumption, (*2)

    'modules' => [
        'consumption' => [
            'class' => 'halumein\consumption\Module',
        ],
        //...
    ]

В конфигурационный файл также, (*3)

В модуль Order добавить обработку, которая отработает при создании нового заказа, (*4)

,,,, (*5)

'modules' => [, (*6)

'order' => [

    ...

    'on create' => function($event) {
        $order = $event->model;

        $ident  = $order->id;
        $elements = $order->getElements();

        foreach ($elements as $element) {
            $countPrice = $element->count;
            $price = $element->getModel();
            Yii::$app->transaction->addByPrice($price, $countPrice, $ident);
        }
    }

    ...

]

] ,,,, (*7)

дальше обращаться по адресу consumption/имя_контроллера, (*8)

The Versions

03/06 2017

dev-master

9999999-dev https://github.com/halumein

consumption

  Sources   Download

BSD-3-Clause

The Requires

 

by Vadim Trishlin

yii2 application education

22/09 2016

dev-consume

dev-consume https://github.com/halumein

consumption

  Sources   Download

BSD-3-Clause

The Requires

 

by Vadim Trishlin

yii2 application education

13/09 2016

dev-resource

dev-resource https://github.com/halumein

consumption

  Sources   Download

BSD-3-Clause

The Requires

 

by Vadim Trishlin

yii2 application education