vendredi 31 mars 2017

Type casting using string for type

I have table settings with columns: value - varchar type contains setting value and type - enum type contains variable types "int", "string", "float". How can I use string from type column to cast value to this type?

I'm trying to do it in my model but it doesn't work:

public function getValueAttribute($value){
    return ($this->type)$value;
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oixyhB
via IFTTT

Aucun commentaire:

Enregistrer un commentaire