Sure. Just create more than one?
return new UserResource(User::findOrFail($id));
return new UserFoobarResource(User::findOrFail($id));
return UserResource::collection(User::all());
return UserFoobarResource::collection(User::all());
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is there any way where I can create multiple api resources for same model.
First resource is properly reflecting the API resource Keys but second resource is not at all reflecting the API keys, it is showing the API keys of first API resource.
Is there anything that I am missing, I want to create different api resources for same model.
Please or to participate in this conversation.