algo-web / podata-laravel
Expose Odata services from laravel
Installs: 3 192
Dependents: 0
Suggesters: 0
Security: 0
Stars: 33
Watchers: 4
Forks: 28
Open Issues: 12
pkg:composer/algo-web/podata-laravel
Requires
- php: >=5.6.4|^7.0
 - algo-web/podata: 0.3.*|dev-master
 - doctrine/dbal: ^2.5
 - illuminate/http: ^5.1.11|^6.0
 - laravel/framework: ^5.1.11|^6.0
 - symfony/http-foundation: ^2.7|^3.0|^4.0
 - symfony/yaml: ^2.7|^3.0|^4.0
 - voku/anti-xss: 2.1.*
 
Requires (Dev)
- brianium/paratest: ^0.15.0|^1.0
 - mockery/mockery: dev-master
 - orchestra/database: 3.1.*|3.2.*|3.3.*|3.4.*|3.5.*|3.6.*|3.7.*|3.8.*|^4.0
 - orchestra/testbench: 3.0.*|3.1.*|3.2.*|3.3.*|3.4.*|3.5.*|3.6.*|3.7.*|3.8.*|^4.0
 - php-coveralls/php-coveralls: >=v2.1
 - phpunit/phpunit: ^5.6|^6.0|^7.0|^8.0
 
README
POData-Laravel
Composer Package to provide Odata functionality to Laravel
- PHP 5.6 support has been dropped *
 
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, AlgoWeb\PODataLaravel\Providers\MetadataControllerProvider::class,
You then add the trait to the models you want to expose.
use \AlgoWeb\PODataLaravel\Models\MetadataTrait;
By default, following Laravel convention, POData-Laravel pluralises the model names to use as endpoints. That's an implementation choice in POData-Laravel, not anything intrinsic to OData itself.
Eg, for User model, all else equal:
/odata.svc/Users
If you have just installed the package and have trouble reaching your models' endpoints, try setting APP_DISABLE_AUTH=true in your project's .env file temporarily, and then try reaching those endpoints again.
-- 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
 - Assumes autoloader has been optimised with composer -o dump-autoload.
 
-- Configuration options -- These need to go in your Laravel project's .env file.
- 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
 - $count
 -  $filter
-  Comparison Operators
- eq
 - ne
 - lt
 - le
 - gt
 - ge
 
 -  Logical Operators
- and
 - or
 - not
 
 -  Comparison Operators
- has
 
 -  String Functions
- indexof
 - contains
 - endswith
 - startswith
 - length
 - substring
 - tolower
 - toupper
 - trim
 - concat
 
 -  Arithmetic Operators
- add
 - sub
 - mul
 - div
 - mod
 
 -  Date Functions
- year
 - month
 - day
 - hour
 - minute
 - second
 - fractionalseconds
 - date
 - time
 - totaloffsetminutes
 - now
 - mindatetime
 - maxdatetime
 
 -  Math Functions
- round
 - floor
 - ceiling
 
 
 -  Comparison Operators
 - $select
 - $top
 - $skip
 - $skiptoken
 - $orderby
 - $expand