<?php

namespace App\Services;

use App\Interface\HistoryOwner;

class HistoryService {
    public function add(HistoryOwner $historyOwner, string $event, array $context = [], ?int $user = null) {
        $historyOwner->history()->create([
            'action' => $event,
            'user_id' => is_null($user) ? auth()->id() : $user,
            'context' => $context
        ]);
    }
}