Yii2-Swap is module, that helps your users to swap different things., (*1)
Getting started with Yii2-swap
*** Alpha version v0.8.3-alpha ***, (*2)
1. Download
Yii2-Swap extension can be installed using composer. Run the command bellow in console to download
and install Yii2-swap:, (*3)
composer require kirillantv/yii2-swap
or you can add following require to composer.json:, (*4)
...
"require": {
...
"kirillantv/yii2-swap": "*"
...
}
Add following lines to your main configuration file:, (*5)
'modules' => [
'swap' => [
'class' => 'kirillantv\swap\Module',
],
],
3. Update database schema
The last thing you need to do is updating your database schema by applying the
migrations. Make sure that you have properly configured db
application component
and run the following command:, (*6)
$ php yii migrate/up --migrationPath=@vendor/kirillantv/yii2-swap/migrations
4. Available actions
Backend management actions
NOTE: It is not recommended to use actions below in frontend. Even swap/management/items/create action.
All index pages designed as GridView by default, (*7)
0. Simple start
You can get access to swap console easily with action below:, (*8)
swap/management
, (*9)
1. Items
swap/management/items
list of all items
swap/management/items/create
create item in module management page, (*10)
2. Categories
swap/management/categories
list of all categories, (*11)
swap/management/categories/create
create category, (*12)
3. Bets
swap/management/bets
list of all bets, (*13)
swap/management/bets/create
create bet in module management page, (*14)
4. Orders
swap/management/orders
list of all orders, (*15)
swap/management/orders/create
create order manually, (*16)
5. Attributes
swap/management/attributes
list of all attributes, (*17)
swap/management/attributes/create
create attributes for your items, (*18)
6. Attribute Values
swap/management/values
junction table for items and attributes, (*19)
swap/management/values/create
create manually junction between item and attribute. Just for specific solutions, (*20)
7. Visual Configuration
swap/management/basic-configuration
configurate module, (*21)
Frontend actions
1.Items
swap/items
input all active items, (*22)
swap/items/create
create item with attributes, categories and bets, (*23)
swap/items/edit
param id
. Update form for item, (*24)
swap/items/view
param id
. View form for item. Users can swap from this page., (*25)
2. Orders
swap/orders/create
create order when user clicks swap button. Available to choose bet, (*26)
User actions
Yii2-Swap provides user's items and orders output. You can add corresponding actions in profile menu or override views, (*27)
1. Items
swap/user/items
main action for user's items, (*28)
swap/user/items/active
user's active items, (*29)
swap/user/items/archive
user's archive items, (*30)
2. Orders
swap/user/orders
main action for user's orders, (*31)
swap/user/orders/active
user's active orders, (*32)
swap/user/orders/archive
user's archive orders, (*33)
3. Messages
Attention! Message module is not stable., (*34)
Extension supports specific message system by the default. After migration in your DB swap_message
table will appear. We need for prefix not to conflict with your chat or mail system.
We included message model in default orders controller and view. But you can access to inbox and conversation using controllers bellow:, (*35)
swap/message/inbox
- list of all user's conversations grouped by item_id
, (*36)
swap/message/conversation
- need for GET parameters: hash
, item
, from
, to
of any message from current user's conversation. So foreign user can't enter to conversation., (*37)