PHP code example of qpi / laravel

1. Go to this page and download the library: Download qpi/laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

qpi / laravel example snippets


Navac\Qpi\QpiServiceProvider::class,

return [

  /*
  |--------------------------------------------------------------------------
  | Qpi Models
  |--------------------------------------------------------------------------
  |
  | The models listed here will be available for Qpi to make responses.
  |
  */
  'models' => [
    'user' => App\User::class,
    'product' => App\Product::class,
  ]

];

class Product extends Model {

    public function qpiAccess() {
        if(request()->header('Authorization') != 'the valid token') {
            throw new \Exception('Authorization failed.');
        }
    }

}

class Product extends Model {
    public static $qpiProps = [
        'id' => 'The id',
        'name' => 'The name of the product',
        ...
    ];

    public static $qpiRelations = [
        'tags' => 'Related tags of product',
        ...
    ];
    
    ...

php artisan vendor:publish