query in field i want to make query in fields i used this but it's return fix value in resource
Number::make('Name'
, function () {
return \App\Tag::query()->with('questions')->count()
}),
@hala I don't know your whole code, but you propably want to get count of questions from your tag, but you need get item of tag for it.
Number::make('Name' , function () use ($tag) {
return $tag->questions()->count();
}),
well yes ,i used this in index Query method but now i need more than relation so i can not use it ,
when i used this return fixed value , so i was looking how to query in fields not lens or filter
What exactly do you want to achieve ? And what's your resource like is it a Tag resource and you want to get the count of questions for each tag?
well i need to know how many question in each tag in index page
yes i'm in Tag Resource
i used indexQuery method before and it was fine but now i have many queries to do
and i don't want to use lens or actions
Is this not working ?
Number::make('Questions Count' , function () {
return $this->questions->count();
}),
thank you a lot , yes it works now ,
Please sign in or create an account to participate in this conversation.