chicky / laravel-modules
Gamota Laravel Module management (For Landing)
Fund package maintenance!
nwidart
Requires
- php: >=8.0
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.6
- laravel/framework: ^9.0
- mockery/mockery: ^1.4
- orchestra/testbench: ^7.0
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^9.5
- spatie/phpunit-snapshot-assertions: ^4.2
- dev-master / 9.0.x-dev
- v9.0.7
- v9.0.6
- v9.0.5
- v9.0.4
- v9.0.3
- v9.0.2
- v9.0.1
- v9.0.0
- v8.3.0
- 8.2.0
- 8.1.0
- 8.0.0
- 7.3.0
- 7.2.0
- 7.1.0
- 7.0.x-dev
- 7.0.0
- 6.2.0
- 6.1.0
- 6.0.x-dev
- 6.0.0
- 5.1.0
- 5.0.x-dev
- 5.0.1
- 5.0.0
- 4.1.0
- 4.0.x-dev
- 4.0.0
- 3.3.1
- 3.3.0
- 3.2.1
- 3.2.0
- 3.1.0
- 3.0.x-dev
- 3.0.1
- 3.0.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.x-dev
- 2.0.0
- 1.27.2
- 1.27.1
- 1.27.0
- 1.26.0
- 1.25.1
- 1.25.0
- 1.24.0
- 1.23.0
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.0
- 1.18.0
- 1.17.1
- 1.17.0
- 1.16.0
- 1.15.0
- 1.14.0
- 1.13.1
- 1.13.0
- 1.0.x-dev
- 0.12.0
- 0.11.2
- 0.11.1
- 0.11.0
- 0.10
- 0.9
- 0.8
- 0.7
- 0.6
- 0.5
- 0.4
- 0.3
- 0.2
- 0.1
- dev-feature/use-laravel-migrator
- dev-feature/database-modules
This package is auto-updated.
Last update: 2024-11-06 15:40:51 UTC
README
chicky/laravel-modules
is a Laravel package which created to manage your large Laravel app using modules, mostly just use to support Gamota Landing System. Module is like a Laravel package, it has some views, controllers or models. This package is supported and tested in Laravel 9.
Install
To install through Composer, by run the following command:
composer require chicky/laravel-modules
The package will automatically register a service provider and alias.
Optionally, publish the package's configuration file by running:
php artisan vendor:publish --provider="Nwidart\Modules\LaravelModulesServiceProvider"
Autoloading
By default, the module classes are not loaded automatically. You can autoload your modules using psr-4
. For example:
{ "autoload": { "psr-4": { "App\\": "app/", "Modules\\": "Modules/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" } }
Tip: don't forget to run composer dump-autoload
afterwards.
Documentation
Basic documentation on https://docs.laravelmodules.com/.
Gamota Components Document
Requirements
- Add variables in env file (support for Landing API):
PURCHASE_LIST_GAME_SECRET_KEY= PURCHASE_SECRET_KEY= PURCHASE_GET_ROLE_SECRET_KEY= PAY_AUTH_SECRET_KEY= GAME_API_KEY= APPOTA_API_KEY= TELEGRAM_API_KEY= SENDGIFT_VERIFY_TOKEN=
- Install
Passport
php artisan migrate php artisan passport:install
1. Create Module
- Have 2 ways to create a module:
Way 1:
Create module with default
- Step 1:
php artisan module:make <Module Name> --support="gamota"
- Step 2:
php artisan make:gamota-component birthday --components="item,item_log"
.
Components: item, item_log, role, payment, config.
Way 2 (recommend):
Create module with components
- Step 1:
php artisan module:make <Module Name> --components="item,item_log,config,share,payment,role" --support="gamota"
Components: item, item_log, role, payment, config.
Parameter --support="gamota"
to generate module controller support Gamota Landing APIs
Run Migrate
- Don't forget
php artisan module:migrate <Module Name>
2. Add Module to Sidebar in CMS
Insert this code @include('trianvip::partials.sidebar.trianvip')
in file: resources/views/partials/sidebar.blade.php
3. Create Send Gift Console
- Run
php artisan module:make-sendgift-command <Module Name>
. - Add below code to Module Service Provider
$this->commands([ SendGiftCommand::class, ]);
- Run command
php artisan module_name:send-gift
. Example:php artisan birthday:send-gift
List Laravel command:
php artisan list
4. Landing API docs
- Base URL: https://trutien.gamota.net
- Dev Base URL: https://dev-trutien.gamota.net
Login
Login Normal
- URL:
api/<module_name>/login
- Method:
POST
- Params:
username
: Stringpassword
: String
-
response: JSON
{ "error": int, "message": "string", "data": { "appota_userid": 2618078, "appota_username": "Xuanxuxu", "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIyNjE4MDc4IiwiaWF0IjoxNjU1Nzk0Mzk0LCJhcHBvdGFfdXNlcmlkIjoiMjYxODA3OCIsImFwcG90YV91c2VybmFtZSI6Ilh1YW54dXh1IiwiZXhwIjoxNjU1ODA1MTk0fQ.NlgsXksofRR_tGfodO-CRWkv_tJXsXvYDRuPyNu08Dc", "expired": 1655805194 } }
Login Google
- URL:
api/<module_name>/login
- Method:
POST
- Params:
google_token
: String
-
response: JSON
{ "error": int, "message": "string", "data": { "appota_userid": 2618078, "appota_username": "Xuanxuxu", "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIyNjE4MDc4IiwiaWF0IjoxNjU1Nzk0Mzk0LCJhcHBvdGFfdXNlcmlkIjoiMjYxODA3OCIsImFwcG90YV91c2VybmFtZSI6Ilh1YW54dXh1IiwiZXhwIjoxNjU1ODA1MTk0fQ.NlgsXksofRR_tGfodO-CRWkv_tJXsXvYDRuPyNu08Dc", "expired": 1655805194 } }
Login Facebook
- URL:
api/<module_name>/login
- Method:
POST
- Params:
facebook_token
: String
-
response: JSON
{ "error": int, "message": "string", "data": { "appota_userid": 2618078, "appota_username": "Xuanxuxu", "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIyNjE4MDc4IiwiaWF0IjoxNjU1Nzk0Mzk0LCJhcHBvdGFfdXNlcmlkIjoiMjYxODA3OCIsImFwcG90YV91c2VybmFtZSI6Ilh1YW54dXh1IiwiZXhwIjoxNjU1ODA1MTk0fQ.NlgsXksofRR_tGfodO-CRWkv_tJXsXvYDRuPyNu08Dc", "expired": 1655805194 } }
Server and Role
List Server
- URL:
api/<module_name>/list-server
- Authorization: null
- Method:
GET
- Params:
username
: Stringpassword
: String
-
response: JSON
{ "error": 0, "message": "", "data": { "23001": "Bích Dao", "23092": "Cửu Ngạn", "23102": "Đại Bằng", } }
List Role
- URL:
api/<module_name>/list-role
- Headers:
Authorization: Bearer <access_token>
- Method:
GET
- Params:
server_id
: Int
-
response: JSON
{ "error": int, "message": "string" "data": { "6474205939321801742": "Rufuif", "6484620513460142559": "Xxtyu", "6486872313273780784": "xuanxuxu", "6490531487971060786": "heoheo", "6491375912901154073": "chipchip" } }
Attend
Attend
- URL:
api/<module_name>/attend
- Headers:
Authorization: Bearer <access_token>
- Method:
POST
- Params:
role_id
: Stringrole_name
: Stringserver_id
: Stringserver_name
: String
-
response: JSON
{ "error": 0, "message": "", }
Role Info
Get Role Info
- URL:
api/<module_name>/get-role-info
- Headers:
Authorization: Bearer <access_token>
- Method:
GET
- Params:
role_id
: String
-
response: JSON
{ "error": 0, "message": "", "data": { "spin_total": 100, "spin_received": 20, "spin_available": 80, "detail": [ "role_id": "6490250012994306385", "role_name": "BăngČTuyết", "server_name": "Đằng Vân", "spin_total": "100" ] } }
Spin
Spin
- URL:
api/<module_name>/spin
- Headers:
Authorization: Bearer <access_token>
- Method:
POST
- Params:
role_id
: Stringserver_id
: Stringtype
: Integer | Enum (1, 3, 6)
-
response: JSON
{ "error": 0, "message": "", "data": { "spin_total": 100, "spin_received": 20, "spin_available": 80, "detail": [ { "gift_title": "Quà ingame ", "gift_id": 1, "position": 1 }, { "gift_title": "Quà ingame ", "gift_id": 1, "position": 1 }, { "gift_title": "Áo Tru Tiên", "gift_id": 2, "position": 2 } ] } }
Rule
Get Rule
-
URL:
api/<module_name>/rule
-
Authorization: None
-
Method:
GET
-
Params:
-
response: JSON
{ "error": 0, "message": "", "data": "<p>Rule Text<p>" }
History
List History
- URL:
api/<module_name>/histories
- Headers:
Authorization: Bearer <access_token>
- Method:
GET
- Params:
role_id
: Stringtype
: String - Type: spin
-
response: JSON
{ "error": 0, "message": "", "data": [ { "gift_id": 1, "gift_type": "spin", "gift_title": "Quà ingame", "role_name": "BăngČTuyết", "server_name": "Đằng Vân", "created_at": "2022-06-20 17:56:30", "detail": { "title": "Quà ingame", "image": "https://trutien.gamota.com/wp-content/uploads/2021/03/giang-tu-tinh-hon.png\r\n" } }, ... ] }
Rank
List Rank
-
URL:
api/<module_name>/api/ranks
-
Authorization: None
-
Method:
GET
-
Params:
-
response: JSON
{ "error": 0, "message": "", "data": [ { "role_name": "BăngČTuyết", "server_name": "Đằng Vân", "counted_rows": 14, "appota_userid": 2618078, "appota_username": "caongocthu1995" }, ... ] }
Share
Post Share
-
URL:
api/<module_name>/share
-
Headers:
Authorization: Bearer <access_token>
-
Method:
POST
-
Params:
- role_id: integer | required
-
response: JSON
{ "error": integer, "message": string }
Get Total Share
-
URL:
api/<module_name>/total-share
-
Authorization: None
-
Method:
GET
-
Params:
-
response: JSON
{ "error": integer, "message": string, "data": 1 }
For Developer
- Run
docker-compose up
- Run
docker exec -it api-gamota-landing_php-fpm_1 bash
to access to server. - Run
chown -R 1000:1000 Modules/
to set permission for Module folder.