PHP code example of ismaildasci / laravel-sapb1-toolkit
1. Go to this page and download the library: Download ismaildasci/laravel-sapb1-toolkit 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/ */
ismaildasci / laravel-sapb1-toolkit example snippets
use SapB1\Toolkit\ChangeTracking\ChangeTracker;
$tracker = ChangeTracker::for('Orders')
->primaryKey('DocEntry')
->detectCreated(true)
->detectUpdated(true);
$changes = $tracker->poll();
foreach ($changes as $change) {
if ($change->isCreated()) {
// Handle new order
}
}
use SapB1\Toolkit\Sync\LocalSyncService;
$syncService = app(LocalSyncService::class);
// Sync to local database
$result = $syncService->sync('Items');
// SyncResult { created: 10, updated: 140, deleted: 0, duration: 1.23s }
// Full sync with soft delete detection
$result = $syncService->fullSyncWithDeletes('Items');
// Scheduler integration
$schedule->command('sapb1:sync Items')->hourly();
$schedule->command('sapb1:sync Items --full')->weekly();