<?php


namespace App\Models\Traits;


use App\Models\Polymorphs\AuditLog;

trait HasAuditLogs{



    protected function getBeforeValues($attributes = []){
        $originals = array_keys($this->getOriginal());
        $attributes = (empty($attributes)) ? $originals : $attributes;
        $beforeValues = [];

//       if ($attributes){
//           foreach ($attributes as $attribute) {
//               $beforeValues[$attribute] = $originals[$attribute];
//           }
//       }
      return $beforeValues;
    }

    protected function getAfterValues($attributes = []){
        $changes = array_keys($this->getChanges());
        $attributes = (empty($attributes)) ? $changes : $attributes;
        $afterValues = [];

//        if ($attributes){
//            foreach ($attributes as $attribute) {
//                $afterValues[$attribute] = $changes[$attribute];
//            }
//        }
        return $afterValues;
    }

}
