36 lines
788 B
PHP
36 lines
788 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class JSONApiServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Register the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->app['Dingo\Api\Transformer\Factory']->setAdapter(function ($app) {
|
|
$baseUrl = 'http://api.questionnaire.dev/v1';
|
|
$manager = new \League\Fractal\Manager;
|
|
$manager->setSerializer(new \League\Fractal\Serializer\JsonApiSerializer($baseUrl));
|
|
|
|
|
|
return new \Dingo\Api\Transformer\Adapter\Fractal($manager, 'include', ',');
|
|
});
|
|
}
|
|
}
|