DEV Community

Discussion on: Laravel Inertia and API Resources

Collapse
 
carbontwelve profile image
Simon Dann

A benefit of this approach is that you can check to see if the request requires json and return the resource directly, that way you can have the same controller method handle api and web requests without duplication.

This is what I have done with one application that has a mobile app needing to communicate on some endpoints.

Collapse
 
bhaviljain68 profile image
bhaviljain68

Hey, neat idea.
How exactly would you do this?
Can you provide an example please?