O
O
on_click2020-12-28 22:16:05
Laravel
on_click, 2020-12-28 22:16:05

How to access a package method through Lighthouse GraphQL?

Hello!

I installed the package https://github.com/rtconner/laravel-likeable
In the controller, to get the number of likes, I use the built-in $comment->likeCount method;

Can you please tell me how to pass this value to my graphql "Comment" type without using custom queries? Is it possible?

type Comment {
    id: ID!
    comment: String!
    created_at: String!
    updated_at: String!
    likeCount: Int # как то так)
}

I see the @morphMany directive in the documentation, but no matter how I try, it doesn’t work out, is it by chance not the right direction?

Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question