hungnguyenba / apidriver
There is no license information available for the latest version (v0.0.13) of this package.
A Api based Eloquent model and Query builder for laravel (Api Eloquent)
v0.0.13
2018-02-08 11:58 UTC
Requires
README
This package was only used in my personal projects with special use cases, so you shouldn't use it. I will rewrite it for common use cases when i have rest time. Thank you!
API Driver For Laravel 5.2
An Eloquent model and Query builder with support for Restful Api Server, using the original Laravel API. This library extends the original Laravel classes, so it uses exactly the same methods.
Installation
Installation using composer:
composer require hungnguyenba/apidriver
And add the service provider in config/app.php
:
Hungnguyenba\Apidriver\DatabaseServiceProvider::class
Configuration
Change your default database connection name in config/database.php
:
'default' => 'api'
And add a new api server connection:
'api' => [ 'driver' => 'api', 'host' => 'localhost/v1/', 'database' => '', 'prefix' => '', ]
Usage
Create new Model extend Api Eloquent Model:
use Hungnguyenba\Apidriver\Model\Model; class User extends Model { }
Using the original Eloquent API:
$users = User::where('id', '<', 100)->take(3)->get(); $user = User::find(3); $user->delete();