Under development!
#install
This assumes you've already installed Laravel 5.1.19 (neoeloquent is not compatible with later changes to the builder in Laravel)
-
Install package with
composer require wetcat/litterbox-api dev-master
-
Add provider
Wetcat\Litterbox\LitterboxServiceProvider::class,
-
Publish config
php artisan vendor:publish
and modify to suit your Neo server. -
Update configs.
-
Add datbase settings
'default' => 'neo4j',
'connections' => [
'neo4j' => [
'driver' => 'neo4j',
'host' => 'localhost',
'port' => '7474',
'username' => null,
'password' => null
]
]
- Register middleware in
App\Http\Kernel.php
protected $routeMiddleware = [
'cors' => Barryvdh\Cors\HandleCors::class,
'litterbox-guest' => \Wetcat\Litterbox\Middleware\Guest::class,
'litterbox-auth' => \Wetcat\Litterbox\Middleware\Auth::class,
'litterbox-order' => \Wetcat\Litterbox\Middleware\Order::class,
'litterbox-admin' => \Wetcat\Litterbox\Middleware\Admin::class,
'litterbox-superadmin' => \Wetcat\Litterbox\Middleware\Superadmin::class,
];
- Set up CORS
app\config\cors.php
return [
'supportsCredentials' => false,
'allowedOrigins' => ['*'],
'allowedHeaders' => ['Content-Type', 'Accept', 'X-Litterbox-Token'],
'allowedMethods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
'exposedHeaders' => [],
'maxAge' => 0,
'hosts' => [],
]
- Make sure to disable CSRF tokens in
app\Http\Kernel.php
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
//\App\Http\Middleware\VerifyCsrfToken::class,
];