Tailor is able to handle Relation controller

Hi :slight_smile:

Tailor is able to handle relation controller?
And Tailor is able to handle Model’s funtions like
public static function getYearOptions($year, $parent) {}

Or it is necessary to create my own model?

Thank you,

Tailor will have complete support for Relation Controller in v4. In latest version of v3 there is partial support with the entries field type, you can set it to displayMode: controller for 1-level management. It is undocumented though.


Sounds great! Thank you :slight_smile:

Hi @daft ,

Am I able to dropdown options add a function like getYearOptons()

public function getYearOptions()
        $currentYear = Carbon::now()->year;
        $startYear = 1990;
        return collect(range($startYear, $currentYear + 1))->flip()->map(function ($year) {
            return $year;

and in yaml file be like:

        label: Year
        type: dropdown
        size: small
        options: getYearOptions

Or how can I solve it with Tailor to render an array with year, from 1990 to $currentYear + 1?

Thank you,

Yes, with a static method

options: "Path\To\My\Class::getYearOptions"
1 Like

Thank you, it is amazing! :slight_smile:

1 Like