PHP code example of bantenprov / advancetrust
1. Go to this page and download the library: Download bantenprov/advancetrust 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/ */
bantenprov / advancetrust example snippets bash
$ php artisan vendor:publish --tag="laratrust"
$ php artisan vendor:publish
$ php artisan laratrust:setup
$ php artisan laratrust:seeder
$ php artisan laravel-api-manager:add-route
$ php artisan migrate
$ composer dump-autoload
$ php artisan db:seed --class=LaratrustSeeder
$ php artisan serve
bash
$ php artisan advancetrust:add-route
$ php artisan advancetrust:create-controller
$ php artisan advancetrust:create-view
$ php artisan advancetrust:version
bash
$ php artisan make:auth
php
// method get
Route::get('/guzzle/permission/get',function(){
$hostname = \Request::root();
$client = new GuzzleHttp\Client(['base_uri' => env('BANTENPROV_ROLEHOST').'/api/v1/advancetrust/']);
$response = $client->request('GET', 'permission',[
'headers' => [
'secret_key' => 'QwQjR4V8VKXqvWR3l7v056VU9l2d2JKkcXvM9GQKYhn8J5gsGKNdEYj6cHaoP5HOne51TwSRk4CT0ksZjCUCEEKi6V1a34bQqXEI',
'client' => $hostname
]
]);
return $response->getBody();
});
Route::get('/guzzle/role/get',function(){
$hostname = \Request::root();
$client = new GuzzleHttp\Client(['base_uri' => env('BANTENPROV_ROLEHOST').'/api/v1/advancetrust/']);
$response = $client->request('GET', 'role',[
'headers' => [
'secret_key' => 'QwQjR4V8VKXqvWR3l7v056VU9l2d2JKkcXvM9GQKYhn8J5gsGKNdEYj6cHaoP5HOne51TwSRk4CT0ksZjCUCEEKi6V1a34bQqXEI',
'client' => $hostname
]
]);
return $response->getBody();
});
//method post
Route::get('/guzzle/permission/post',function(){
$hostname = \Request::root();
$client = new GuzzleHttp\Client(['base_uri' => env('BANTENPROV_ROLEHOST').'/api/v1/advancetrust/']);
$response = $client->request('POST', 'permission/store',[
'headers' => [
'secret_key' => 'QwQjR4V8VKXqvWR3l7v056VU9l2d2JKkcXvM9GQKYhn8J5gsGKNdEYj6cHaoP5HOne51TwSRk4CT0ksZjCUCEEKi6V1a34bQqXEI',
'client' => $hostname
],
'form_params' => [
'name' => 'example name',
'description' => 'example description',
'display_name' => 'example display name'
]
]);
return $response->getBody();
});
Route::get('/guzzle/role/post',function(){
$hostname = \Request::root();
$client = new GuzzleHttp\Client(['base_uri' => env('BANTENPROV_ROLEHOST').'/api/v1/advancetrust/']);
$response = $client->request('POST', 'role/store',[
'headers' => [
'secret_key' => 'QwQjR4V8VKXqvWR3l7v056VU9l2d2JKkcXvM9GQKYhn8J5gsGKNdEYj6cHaoP5HOne51TwSRk4CT0ksZjCUCEEKi6V1a34bQqXEI',
'client' => $hostname
],
'form_params' => [
'name' => 'example name',
'description' => 'example description',
'display_name' => 'example display name'
]
]);
return $response->getBody();
});
bash
$ php artisan serve --port=9090
bash
$ php artisan serve