This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi All,
I created a plugin where I can create posts and each post belong to a category Lets say in the Category model there is
id:2, name:News and there is a Post
id:1, title: first post, category_id:2
So when this post is shown in the list behavior, it shows category_id to be 1. Is it possible to manipulate the list behavior so that it shows the name of the category it belongs to instead of just the category_id.
So I think in other word which file should I edit so that I can make query to the DB to get category.name to be shown. Thanks.
Last updated
ya i am expecting something that allows me to use relationship query to retrieve the information to show using category_id instead of just showing category_id
Thanks for your push on the post.
I have found part of the solution, but not completely. At the lists, instead of using xxx_id, you can just use xxx, it will return the whole array. I am having difficulty narrowing it down to just the column I need though.
Edit: I believe the answer is in the way yaml works.
Last updated
I have made further breakthrough in this problem. Make a .htm file in your respective models file, something like _novel_column.htm Inside it you can write a code like this: <?= $value->name ?> Inside your columns.yaml file configuration for the list, make the type of the column partial, and write the path to the .htm file you created, starting with ~/plugins/
This way, you should be able to display what you want. The only problem now is that it isn't searchable or sortable.
1-5 of 5