/** * Audit model */ public function audit(array $log) { $logAuditing = ['old_value' => json_encode($log['old_value']), 'new_value' => json_encode($log['new_value']), 'owner_type' => get_class($this), 'owner_id' => $this->getKey(), 'user_id' => $this->getUserId(), 'type' => $log['type'], 'created_at' => new \DateTime(), 'updated_at' => new \DateTime()]; return Log::insert($logAuditing); }