How are you accessing it ?
Check whether this is even being called ??
public function getIdsTipoPatenteAttribute($value) {
dd($value);
}
Hi, I've a model with a field named "idsTipoPatente". This is a string field in database with values like "10,11". I need to convert in an array.
I try with:
protected $casts = [
'idsTipoPatente' => 'array',
];
but return an empty attribute. I also try with this accessor:
public function getIdsTipoPatenteAttribute($value) {
//dummy return
return "1";
}
but return the same value ("10,11"). Whats wrong? Thanks a lot Stefano
If you are not using snake_cased attributes, you should set $snakeAttributes property to false:
class YourModel extends Model
{
public static $snakeAttributes = false;
}
Please or to participate in this conversation.