laravel-generator icon indicating copy to clipboard operation
laravel-generator copied to clipboard

[Feature]: Suggestion - Dingo API Integration

Open daniel-huang opened this issue 9 years ago • 7 comments

It's an awesome project!

Will it support Dingo API?

daniel-huang avatar Feb 18 '16 07:02 daniel-huang

Yes, its on plan.

mitulgolakiya avatar Feb 18 '16 13:02 mitulgolakiya

You know All I had to do to get dingo working is replace the API code you generate from the one you were generating in your previous package

$api = app('api.router');

$api->version('v1', function ($api) {
    $api->group(['namespace' => 'App', 'middleware' => 'cors'], function ($api) {
        require config('infyom.laravel_generator.path.api_routes');
    });
});

And then in the api_routes.php I replaced Resource:: by $api->resource

And that's it? Isn't it? I did that and I'm using Dingo. Piece of cake no? Or am I missing something.

vesper8 avatar Apr 26 '16 12:04 vesper8

@vesper8 I'm not sure. Not much experienced with dingo. But will check, if that's it then will add it.

mitulgolakiya avatar Apr 26 '16 18:04 mitulgolakiya

Dingo uses its own router so I would prefer instead to keep Infy's great design of using the built-in router and addition of the api_routes file via a route group. Less error prone and cleaner design.

malhal avatar May 04 '16 07:05 malhal

@daniel-huang Can you mention precisely what you expect from such integration?

@mitulgolakiya I'm available to help with this if needed. Have been using Dingo with laravel-generator for some years now. The major addition is probably in the generation/scaffolding of transformers.

xwiz avatar Jun 02 '20 00:06 xwiz

@xwiz Great. so yes, if someone can highlight a brief plan here, what kind of integration is needed or will be useful as an optional feature/add-on (as all users will not be using it). then we can plan something.

mitulgolakiya avatar Jun 02 '20 05:06 mitulgolakiya

@mitulgolakiya So basically the idea of transformers is mostly about fractals/includable resources.

For example, assuming you want to retrieve a project model, you also want to retrieve the task models, and possible the time logs related to it, etc. With transformers, we can load all that extra information as needed by client without needing to write extra API endpoints/methods.

xwiz avatar Jun 02 '20 10:06 xwiz