Package - Algo-Web/POData-Laravel

Build Status Scrutinizer Code Quality Coverage Status Latest Stable Version Latest Unstable Version Total Downloads Monthly Downloads Daily Downloads

POData-Laravel

Composer Package to provide Odata functionality to Laravel to install run

composer require algo-web/podata-laravel

Edit config/app.php and add this to providers section:

AlgoWeb\PODataLaravel\Providers\MetadataProvider::class,
AlgoWeb\PODataLaravel\Providers\MetadataRouteProvider::class,
AlgoWeb\PODataLaravel\Providers\QueryProvider::class,

You then add the trait to the models you want to expose.

    use \AlgoWeb\PODataLaravel\Models\MetadataTrait;

-- Known Limitations --

  • Cannot expose two models with the same class name in different namespaces - trying to expose both App\Foo\Model and App\Bar\Model will trip an exception complaining that resource set has already been added.
  • This can be worked around by setting a custom endpoint name on one of the colliding models.
  • Controller input parameters map 'id' to underlying model's primary key

-- Configuration options --

  • APP_METADATA_CACHING - Whether or not to turn model metadata caching on
  • APP_METADATA_CACHE_DURATION - If caching, how long (in minutes) to retain cached metadata
  • APP_DISABLE_AUTH - Disable authentication (boolean)
  • APP_DRY_RUN - Roll back DB changes unconditionally (boolean)

Contributing

See CONTRIBUTING.md for the details.

Features Supported

(thanks to @renanwilliam for the initial version of this list)

  • [ ] Full CRUD Support
  • [x] $count
  • [x] $filter
    • [x] Comparison Operators
      • [x] eq
      • [x] ne
      • [x] lt
      • [x] le
      • [x] gt
      • [x] ge
    • [x] Logical Operators
      • [x] and
      • [x] or
      • [x] not
    • [x] Comparison Operators
      • [x] has
    • [x] String Functions
      • [x] indexof
      • [x] contains
      • [x] endswith
      • [x] startswith
      • [x] length
      • [x] substring
      • [x] tolower
      • [x] toupper
      • [x] trim
      • [x] concat
    • [x] Arithmetic Operators
      • [x] add
      • [x] sub
      • [x] mul
      • [x] div
      • [x] mod
    • [x] Date Functions
      • [x] year
      • [x] month
      • [x] day
      • [x] hour
      • [x] minute
      • [x] second
      • [x] fractionalseconds
      • [x] date
      • [x] time
      • [x] totaloffsetminutes
      • [x] now
      • [x] mindatetime
      • [x] maxdatetime
    • [x] Math Functions
      • [x] round
      • [x] floor
      • [x] ceiling
  • [x] $select
  • [x] $top
  • [x] $skip
  • [x] $skiptoken
  • [x] $orderby
  • [x] $expand

The capabilities under $filter currently rely on the deprecated-in-PHP-7.2 create_function capability.

Github

link
Stars: 5

Advertisement

Releases

v0.2.4 - Dec 27, 2016

Properly handle exceptions when enumerating classes during provider boot

v0.2.3 - Dec 26, 2016

v0.2.2 - Dec 24, 2016

v0.2.1 - Dec 24, 2016

Minor Bugfix