Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Broken link in Quickstart to Magic creation #947

Open
Anticom opened this issue Feb 12, 2025 · 2 comments · May be fixed by #948
Open

Docs: Broken link in Quickstart to Magic creation #947

Anticom opened this issue Feb 12, 2025 · 2 comments · May be fixed by #948

Comments

@Anticom
Copy link

Anticom commented Feb 12, 2025

✏️ Describe the bug

On https://spatie.be/docs/laravel-data/v4/getting-started/quickstart#content-customizing-the-creation-of-a-data-object the link to the details of magic creation methods is broken.

This is the case for v1 docs throughout v4.

Actual (v4):
https://spatie.be/laravel-data/v4/as-a-data-transfer-object/creating-a-data-object#magical-creation

Expected (v4):
https://spatie.be/docs/laravel-data/v4/as-a-data-transfer-object/creating-a-data-object#content-magical-creation

As you can see the path is missing docs and the anchor is missing content prefixes.


Since magical creation methods are one of the more foundational bits of knowledge to acquire IMHO, it would be nice to have this link fixed to help people new to the package (such as me) to find the relevant information more quickly.

@Anticom
Copy link
Author

Anticom commented Feb 12, 2025

Please find my PR attached to this issue.
I'm not 100% sure how to fix this for the prior versions of the docs. Would corresponding PRs help merging into v1, v2 and v3 branches?

Maybe this is a bit too cumbersome to do via PRs. It would be nice if a maintainer could do this with direct access to this repo. Thanks!

@Anticom
Copy link
Author

Anticom commented Feb 12, 2025

Quick question while being at it:

https://spatie.be/docs/laravel-data/v4/as-a-data-transfer-object/creating-a-data-object#content-magical-creation states:

When the package cannot find such a method for a type given to the data object's from method. [...]

Am I correct assuming, that a magic creation method is selected by its parameter signature rather than its name etc.? Meaning that I can have a fromModelA(ModelA $model) as well as fromModelB(ModelB $model) methods on a single Data class and it will select the correct factory method to be used even though both Models extend Elqouent's Model class?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant