attributes['meta_value'] = $value; } public function getMetaValueAttribute( $value ) { if (is_string( $value )) { $decoded = json_decode($value, true); return $decoded ?: $value; } return $value; } public function customer() { return $this->belongsTo( Customer::class, 'customer_id', 'id' ); } }