Writing custom query and getting it's results in antlers template #8483
-
Hi. If it was plain Laravel I could just write a custom function, add it to controller, and then display the results in some blade template. But where should I put this custom function in Statamic correctly, and how should I call it in Antlers then? I suppose query scope or filter won't give me what I want. For example:
Where this logic should be added correctly so it would not be eaten by updates, and how I can call it in antlers template? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
If you're using Antlers, the suggested way here would be to create a "Tag" and perform your query in there. Something like this: public function index()
{
return Entry::query()->etc()->get();
} {{ your_tag }}
{{ title }}, {{ etc }}
{{ /your_tag }} |
Beta Was this translation helpful? Give feedback.
If you're using Antlers, the suggested way here would be to create a "Tag" and perform your query in there.
Something like this: