public function loadPivotAttribute(Model $model, Relation $parentRelation = null)
{
$attributes = $model->getAttributes();
foreach ($attributes as $key => $value) {
if ($key === 'pivot') {
unset($model[$key]);
$pivot = $parentRelation->newExistingPivot($value);
$model->setRelation($key, $pivot);
}
}
}