Here is how defined inside th model. The total does not return in array form after getTotalAttribute is used
protected $casts = [
'total' => 'array'
];
public function getTotalAttribute($value)
{
return $this->_auth($value);
}
CodePudding user response:
You have to make sure “total” in database is a valid JSON format.
The array cast is particularly useful when working with columns that are stored as serialized JSON.
For more info: https://laravel.com/docs/8.x/eloquent-mutators#array-and-json-casting