PHP code example of lanos / laravel-auth0-multi-tenancy-management

1. Go to this page and download the library: Download lanos/laravel-auth0-multi-tenancy-management 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/ */

    

lanos / laravel-auth0-multi-tenancy-management example snippets

`


use Lanos\Auth0MultiManagement\Modules\User

public function getUsers(){

    $users = User::get();
    
    // Alternatively you can apply query paramters as desired
    
    $queryParams = [
        "page" => 2,
        "per_page" => 20
    ];
    
    // This will get page 2 of the results with 20 per page
    $paginated = User::get($queryParams);

}

`


import Lanos\Auth0MultiManagement\Modules\User

public function getUserOrganizations($userID){

    $userOrganizations = User::organizations($userID);
    
    // Alternatively you can apply query paramters as desired
    
    $queryParams = [
        "page" => 2,
        "per_page" => 20
    ];
    
    // This will get page 2 of the results with 20 per page
    $paginated = User::organizations($queryParams);

}

`


import Lanos\Auth0MultiManagement\Modules\Organization

public function addUsesrToOrganization($organizationID){

    $user_ids = [
        "auth0|507f1f77bcf86cd799439020",
        "auth0|507f1f77bcf86cd198439125",
    ];

    $addUser = Organization::addMembers($organizationID, $user_ids);

    // THIS WILL ADD THE 2 ABOVE USER IDS TO THIS ORGANIZATION

}