PHP code example of kauffinger / onoffice-laravel-adapter

1. Go to this page and download the library: Download kauffinger/onoffice-laravel-adapter 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/ */

    

kauffinger / onoffice-laravel-adapter example snippets


return [
    'token' => env('ON_OFFICE_TOKEN'),
    'secret' => env('ON_OFFICE_SECRET'),
    'base_url' => env('ON_OFFICE_BASE_URL', 'https://api.onoffice.de/api/stable/api.php'),
];

$api = new OnOfficeApi(config('onoffice.token'), config('onoffice.secret'));
$request = new OnOfficeApiRequest();
$request->addAction(
    Action::read()
        ->address()
        ->formatOutput()
        ->outputInLanguage(Language::German)
        ->addMobileUrl()
        ->fieldsToRead('phone', 'mobile')
        ->setListLimit(200)
);

$response = $api->send($request);

$request = OnOfficeApiRequest::with(
    Action::read()
        ->task()
        ->fieldsToRead('Eintragsdatum', 'modified')
        ->setRelatedEstateId(2)
        ->setRelatedProjectId(1)
        ->setListLimit(200)
);

$response = OnOfficeApi::for(
    config('onoffice.token'), config('onoffice.secret')
)
    ->send($request);

$request = OnOfficeApiRequest::with(
    Action::read()->estate()
)->withAction(
    Action::read()->address()
);

$response = OnOfficeApi::send($request);
$response->ok(); // would be false

$response->results();
// or as a collection
$response->collectedResults();

$response->getData();
// or as a collection
$response->getCollectedData();
// get the first data array
$response->getData(0);

$response->cacheable();

$request->addAction(
    Action::read()
        ->custom() // this will give you full control over the action, except for the action type
        ->setResourceType('estate')
        ->setResourceId(123)
        ->setParameters([
            'data' => ['Id', 'kaufpreis']
        ])
);
bash
php artisan vendor:publish --tag="onoffice-laravel-adapter-config"