dcasia / custom-relationship-field

Emulate HasMany relationship without having a real relationship set between resources
MIT License
28 stars 6 forks source link

How do we use this with other models? #2

Closed CitizenBeta closed 4 years ago

CitizenBeta commented 4 years ago

How would we use this with a relation other than the same model? Like for your example this only displays other clients on the client page. I'm trying to display another model that belongs to the resource being looked at that isn't related by eloquent. Thank you very much for this package!

CitizenBeta commented 4 years ago

I figured it out but would probably be helpful to others to update the docs a little.

use CustomRelationshipFieldTrait; and all of the customRelationX functions needs to go on the resource class being displayed, not the one being displayed on.

Great package though and very much appreciated!

milewski commented 4 years ago

Hi @CitizenBeta if you could submit a PR updating the README would be awesome, as the creator and my use case sometimes I miss that other may use this differently from the way I am so that's the reason why the documentation doesn't reflect that, but glad you figured that out

LorenzoSapora commented 3 years ago

@CitizenBeta If you remember what you did, could you elaborate? I'll happily write up a PR for the docs based on your experience.

CitizenBeta commented 3 years ago

@LorenzoSapora

Yes, all you have to do is the steps in the documentation but do it on the resource that you want to display, not the one that you want it to show up on. The official docs assume you want them both on the same page.

arturasfrontit commented 1 year ago

Hi @CitizenBeta if you could submit a PR updating the README would be awesome, as the creator and my use case sometimes I miss that other may use this differently from the way I am so that's the reason why the documentation doesn't reflect that, but glad you figured that out

do you still need it?

milewski commented 1 year ago

~Does this package work in nova4? 😃~ oh it does!

Yeah would be helpful to others to have a better description of how to use it / how it can be used etc...