<?php

namespace App\Libraries\Log;

class DataBase
{
  private $_model = null;
  public function __construct()
  {
    $this->_model = new \App\Models\LoggerModel();
  }
  public function save(string $title, bool $status, array $logs)
  {
    $entity = new \App\Entities\LoggerEntity();
    $entity->user_uid = session()->get('uid');
    $entity->title = $title;
    $entity->content = implode("\n", $logs);
    $entity->status = $status ? 'use' : 'unuse';
    return $this->_model->save($entity);
  }
}
