julzlegaspi/odataclient

SAP B1 OData Client

v1.0 2024-11-01 12:45 UTC

This package is auto-updated.

Last update: 2025-03-29 01:09:26 UTC


README

composer require julzlegaspi/odataclient

Publish Provider

php artisan vendor:publish --provider="Julzlegaspi\Odataclient\ODataClientServiceProvider"

Add to .env file

SAP_DB=your_sap_b1_database_name
SAP_USER=your_sap_b1_username
SAP_PASSWORD=your_sap_b1_password
SAP_PATH=https://xxx.xxx.xxx.xxx:50000/b1s/v1
VERIFY_SSL=true //change to false if using self-signed SSL

Usage

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Julzlegaspi\Odataclient\SAPODataClient;

class TestController extends Controller
{
    public function index()
    {
        $odata = new SAPODataClient;

        // Get lists of orders
        $results = $odata->getOdataClient()
            ->from('Orders')
            ->get();
        dd($results);

        // Get order by id
        $result = $odata->getOdataClient()
            ->from('Orders')
            ->find(1);
        dd($result)

        // Update order by id
        $result = $odata->getOdataClient()
            ->from('Orders')
            ->whereKey(1)
            ->patch([
                'key' => 'value'
            ]);
    }
}