Elasticquent
Elasticquent copied to clipboard
How to set eloquent relation data?
Suppose I have Model Post
and every post has many Comment
. So how to set index for this Post with its Comments?
You could bind to a model event such as updated
.
Then iterate through the relations:
$post->comments->each(function ($comment) {
$comment->updateIndex();
});
I would do this asynchronously through a queue.
Please help me i m also facing this issue . how to index relationship. i have company basic info table then address table and phone no table. So how can index company relationship.