PHP code example of dcodegroup / laravel-myob-oauth
1. Go to this page and download the library: Download dcodegroup/laravel-myob-oauth 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/ */
dcodegroup / laravel-myob-oauth example snippets
namespace App\Services\Myob;
use Dcodegroup\LaravelMyobOauth\MyobService;
use XeroPHP\Models\Accounting\Contact;
class MyobService extends MyobService
{
/**
* @inheritDoc
*/
public function createContact(object $data)
{
/**
* $this->>xeroClient is inherited from the BaseXeroService
*/
$contact = new Contact($this->xeroClient);
$contact->setName($data->name . ' (' . $data->code . ')')
->setFirstName($data->name)
->setContactNumber($data->code)
->setAccountNumber($data->code)
->setContactStatus(Contact::CONTACT_STATUS_ACTIVE)
->setEmailAddress($data->email)
->setTaxNumber('ABN')
->setDefaultCurrency('AUD');
$contact = head($contact->save()->getElements());
return $this->xeroClient->loadByGUID(Contact::class, $contact['ContactID']);
}
}
bash
php artsian laravel-myob:install
bash
php artsian migrate
bash
php artsian route:list --name=myob