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

Cant find model... for category #421

Open
interludic opened this issue Oct 31, 2018 · 5 comments
Open

Cant find model... for category #421

interludic opened this issue Oct 31, 2018 · 5 comments

Comments

@interludic
Copy link

  • Corcel Version: "jgrossi/corcel": "2.5.*",

  • Framework Name & Version: "laravel/framework": "5.5.*",

  • PHP Version: 7.1

Description:

Cant find model... for

// clean and simple all posts from a category
$cat = Category::slug('uncategorized')->posts->first();
$cat->posts->each(function($post) {
echo $post->post_title;
});

@crispy-computing-machine

See #414

@jgrossi
Copy link
Member

jgrossi commented Nov 13, 2018

@interludic hi, thanks for reaching out! try to use the Taxonomy class instead of the Category one (removed from Corcel v2):

$first_post = Taxonomy::slug('uncategorized')->posts->first();

hot it helps! let me know if not 😉

@jgrossi
Copy link
Member

jgrossi commented Nov 13, 2018

probably this is missing in the docs, and it would be a great addition! feel free to send a PR 🚀🔥

@LarryBarker
Copy link

@jgrossi I'm unable to get posts for my category this way:
image

@firstaidmarketing
Copy link

@jgrossi I'm unable to get posts for my category this way: image

Got the same issue. I bypassed it by searching through the Post model, but i feel the way the documentation says it should work is better.

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

5 participants