vanilophp / admin

Vanilo Admin Module
MIT License
5 stars 2 forks source link

How to convert property to multiselect #6

Closed arunjoseph02 closed 1 year ago

arunjoseph02 commented 1 year ago

Hi this is not a bug, but a question, I wanted to know how can I convert the below select to multiselect?

I tried with custom properties, I was not able to find a solution

https://vanilo.io/docs/3.x/properties

<?php

namespace App\Models;

class Size implements \Vanilo\Properties\Contracts\PropertyType
{
    public function getName(): string
    {
        return __('Size (S-XXL)');
    }

    public function transformValue(string $value, ?array $settings)
    {
        // @TODO - Fix here
        return 'S,M,XL';
    }
}
arunjoseph02 commented 1 year ago

@fulopattila122 do you have any suggestions ?

fulopattila122 commented 1 year ago

You don't have to create custom classes for each property, just create database entries for size:

image

and also values for them:

image