I would like to link some categories to blog posts, but not all.
If I use the “entries” field (to link categories to blogs), I don’t feel like there is a way to add a condition to display only certain categories.
One solution would be to use a dynamic dropdown/checkbox field.
But then the problem is that the value is not considered as a relationship.
The only solution is to separate each group of categories into differents “entry”?
PS: The same problem arises if you want to use a “relational” field in a form field. Since the “entries” types do not seem to work (only dropdown/checkbox fields work)
Hi and welcome @MallauryGerard
I wonder if you can specify a
scope with the entries field.
label: Basic Entry
Then use the scope to filter the query…
Hello again, @MallauryGerard. We have investigated this requirement and added support for it October CMS v3.1.25. Also, the following has been added to the documentation:
You can restrict the related query using SQL or PHP using the approaches below. In the examples, the related record has a field called
is_featured that renders as a checkbox. We can limit the related records to only those that have this checkbox marked.
SQL Query Condition
You may limit the related model using a raw SQL query using the
conditions: is_featured = true
PHP Query Scope
You may limit the related query using a PHP method with the
label: Basic Entry
This would refer to the
App\Classes\ScopeHelper class that may look a file located in app/classes/ScopeHelper.php, for example.
<?php namespace App\Classes;
public static function applyScope($query)
return $query->where('is_featured', true);
Nice. Great job!
Thank you for your responsiveness.
Thanks for the updates @daftspunky.
I can see the documentation is updated with the new feature but the current release is still v3.1.24.
When do you think the v3.1.25 will be released?
It has been released today. Thanks.