PHP code example of imrul18 / x-desk
1. Go to this page and download the library: Download imrul18/x-desk 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/ */
imrul18 / x-desk example snippets
use .........
use XDesk\XDesk;
class TestController extends Controller
{
public function test(){
// <------ Rest code ------>
$user = [
'name' => "Afnan", //age' => 21,
...
];
$xdesk = new XDesk(
'COMPANY_ID',
'CLIENT_ID',
'ADMIN_ID',
'http://localhost:3000' // origin
);
$data = $xdesk->getURL($user, false); // true for admin Account & false for client account
if ($data['status'] == 200) {
return redirect($data['url']);
} else {
$message = $data['message'];
return view('page', compact('message'));
}
// <------ Rest code ------>
}
};