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

[Bug] MorphToMany cannot retrievable #50111

Closed
brkfun opened this issue Feb 16, 2024 · 2 comments
Closed

[Bug] MorphToMany cannot retrievable #50111

brkfun opened this issue Feb 16, 2024 · 2 comments

Comments

@brkfun
Copy link

brkfun commented Feb 16, 2024

Laravel Version

10.13.5

PHP Version

8.2.8

Database Driver & Version

Postgresql docker image latest

Description

If you try to add the same context as laravel documentation tolds you, over here : https://laravel.com/docs/master/eloquent-relationships#many-to-many-polymorphic-relations i created same tables i created same relation functions over same models. and when i try to gather tags from my post i can't see. You can definetly understand this with the attached image.
K11pD 1

// Post model get.
$p = Post::find(1);

//Post model is here.
dump($p);

//tags are not shown.
dump($p->tags);

//Tags can seen here.
dump($p->tags()->get());

we also try to declare $with over the model to be sure about it can come before initialization. and also in the example you can definetly see that.

Steps To Reproduce

just try to create fresh laravel application and create same tables at the document example and try to run commands i show as example at the above.

@driesvints
Copy link
Member

Heya, thanks for reporting.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here? Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Please do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

@brkfun
Copy link
Author

brkfun commented Feb 16, 2024

it was a silly thing but. It's about having a column as same name as the relation that i've. Sorry about bothering

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

No branches or pull requests

2 participants