GithubHelp home page GithubHelp logo

Comments (4)

liyu001989 avatar liyu001989 commented on September 1, 2024

laravel 5.5 ?并不需要定义在 kernel 中,你把你的环境信息描述一下

from dingo-serializer-switch.

admi2u avatar admi2u commented on September 1, 2024

@liyu001989 laravel 5.5.40

from dingo-serializer-switch.

liyu001989 avatar liyu001989 commented on September 1, 2024

代码看着没有问题,检查是不是有路由缓存

https://github.com/summerblue/larabbs 开源项目 api 分支你自己对比一下

from dingo-serializer-switch.

toknT avatar toknT commented on September 1, 2024

也不是很熟悉dingo @liyu001989 一开始我也觉得好像没生效 代码这么写的:

return $this->response->collection($messages, new MessageTransformer);

但 更具 dingo 的这行 改 resourceKey
https://github.com/dingo/api/blob/master/src/Transformer/Adapter/Fractal.php#L152

fractal 的这行改 serializer
https://github.com/thephpleague/fractal/blob/master/src/Serializer/ArraySerializer.php#L30
其实应该这么写

        return $this->response->collection($messages, new MessageTransformer, ['key' => 'forbar']);

from dingo-serializer-switch.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.