2017 © Pedro Peláez
 

library connect

Connect BAP Platform for laravel 5.*

image

bap/connect

Connect BAP Platform for laravel 5.*

  • Monday, December 5, 2016
  • by nguyenphuocnhatthanh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 602 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Connect Platform for BAP Service

Install

Add the following line to composer.json file and run composer update, (*1)

{
      "require": {
        "bap/connect": "1.*"
      } 
}

Or install with CLI:, (*2)

    composer require bap/connect

Open up config/app.php and add the following to the provires key., (*3)

    Bap\ConnectPlatform\ConnectPlatformServiceProvide::class

You can register the ConnectPlatform Facade aliases key with:, (*4)

     'ConnectPlatform'  => Bap\ConnectPlatform\ConnectPlatformFacade::class

Configuration

You'll need to publish all vendor assets:, (*5)

    php artisan vendor:publish --provider="Bap\ConnectPlatform\ConnectPlatformServiceProvide"

And also run migrations, (*6)

    php artisan migrate

And add PLATFORM_URL to .env, (*7)

    PLATFORM_URL=my_url
    PLATFORM_GRANT=grant
    PLATFORM_CLIENT_ID=CLIENT_ID
    PLATFORM_CLIENT_SECRET=CLIENT_SECRET
    PLATFORM_SCOPE=SCOPE

Add relation devices and contract

...
use Bap\ConnectPlatform\Traits\WithDevices;
use Bap\ConnectPlatform\Contracts\WithDevicesInterface;

class User extends Model implements AuthenticatableContract,
                                    AuthorizableContract,
                                    CanResetPasswordContract,
                                    WithDevicesInterface
{
    use Authenticatable,
        Authorizable,
        CanResetPassword,
        RelationDevices;

Usage

  • Add middleware jwt auth in construsctor method Controller:
    public function __constructor()
    {
        $this->middleware('jwt.auth');
    }
  • Or app/Http/routes.php
    Route::post('me', ['before' => 'jwt-auth', function() {
        // Todo
    }]);
  • Add device to options claims for jwt

Profile

Get profile

Get user profile from Platform with options $attributes = ['id', 'username', 'telephone'], (*8)

<?php
use ConnectPlatform;

ConnectPlatform::profile(array $attributes);

OR, (*9)

<?php
app('platform')->profile(array $attribuites);

Friend

Get list a friend

ConnectPlatform::getFriends($uid);

Get list a friend has been block

ConnectPlatform::getBlockFriends($uid);

Get list ID friend waiting request

ConnectPlatform::getListIdFriendWaiting($uid);

Get list ID friend request

```php ConnectPlatform::getListIdFriendRequest($uid);, (*10)


### Get relation ```php ConnectPlatform::getRelation($uid, $friendUID)

Check list user is friend

```php ConnectPlatform::isFriends($uid, array $uids), (*11)


### Check relation list friend ```php ConnectPlatform::checkListFriends($uid, array $uids)

Send friend request

```php ConnectPlatform::sendFriendRequest($uid, $friendUid);, (*12)


### Approve friend request ```php ConnectPlatform::approveFriendRequest($uid, $friendUid);
With $uids is list USER ID of platform

Search Telephone

```php ConnectPlatform::searchTelephone($uid, array $params);, (*13)

###### With `$params = ['phone_code' => '', 'telephone' => '']` 

## Coin

### Get asset
```php
ConnectPlatform::getCoin($uid);

Get History

```php ConnectPlatform::getHistoryCoin($uid, $action);, (*14)

With `$action in array ['request', 'payment', 'withdraw']`  

### Exchange
```php
ConnectPlatform::exchange($uid, $action, array $params);

With $action in array ['money_coin', 'coin_money'] and $params = ['src' => '' , 'des' => ''], (*15)

Request

```php ConnectPlatform::requestCoin($uid, $coin);, (*16)

### Withdraw money
```php
ConnectPlatform::withDrawMoney($uid, $money);

Get token payment

```php ConnectPlatform::getPaymentToken($uid);, (*17)

### Send payment
```php
ConnectPlatform::requestPayment($uid, array $params);

With $params = ['item_id' => '' , 'item_cat_id' => '', 'item_value' => '', 'token' => ''], (*18)

With $uid is ID of platform

Config file

You can change model, list devices, timeout request at config file., (*19)

The Versions

05/12 2016

dev-master

9999999-dev

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

05/12 2016

v1.0.7

1.0.7.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

24/11 2016

v1.0.6

1.0.6.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

24/11 2016

v1.0.5

1.0.5.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

24/11 2016

v1.0.4

1.0.4.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

22/11 2016

v1.0.3

1.0.3.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

18/11 2016

v1.0.2

1.0.2.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

09/11 2016

v1.0.1

1.0.1.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect

27/10 2016

v1.0.0

1.0.0.0

Connect BAP Platform for laravel 5.*

  Sources   Download

MIT

The Requires

 

by ThanhNguyen

laravel laravel5 connect bap bap connect