App\Repositories\Backend\History\EloquentHistoryRepository::log PHP Method

log() public method

public log ( $type, $text, null $entity_id = null, null $icon = null, null $class = null, null $assets = null ) : boolean | static
$type
$text
$entity_id null
$icon null
$class null
$assets null
return boolean | static
    public function log($type, $text, $entity_id = null, $icon = null, $class = null, $assets = null)
    {
        //Type can be id or name
        if (is_numeric($type)) {
            $type = HistoryType::findOrFail($type);
        } else {
            $type = HistoryType::where('name', $type)->first();
        }
        if ($type instanceof HistoryType) {
            return History::create(['type_id' => $type->id, 'text' => $text, 'user_id' => access()->id(), 'entity_id' => $entity_id, 'icon' => $icon, 'class' => $class, 'assets' => is_array($assets) && count($assets) ? json_encode($assets) : null]);
        }
        return false;
    }