lunarphp / lunar

An open-source package that brings the power of modern headless e-commerce functionality to Laravel.
https://lunarphp.io
MIT License
2.71k stars 357 forks source link

helper function to get model morph name #1947

Closed wychoong closed 2 months ago

wychoong commented 2 months ago

to simplify the usage of getting relationship alias

// before
(new Collection)->getMorphClass()

// after
Collection::morphName()
vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lunar-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 13, 2024 9:36am
alecritson commented 2 months ago

I think this is good to have we'd just need to update the existing codebase so it's consistent.

wychoong commented 2 months ago

I think this is good to have we'd just need to update the existing codebase so it's consistent.

done. I only changed those using (new Model)->getMorphClass, those already have the instance i remain $record->getMorphClass()

added test as well.