<?php

namespace App\Models;

use App\Traits\Auditable;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use DateTime;


class Files extends Model
{
    use Auditable;
    use HasFactory;
     /**
     * The "type" of the auto-incrementing ID.
     * 
     * @var string
     */
    protected $keyType = 'string';

    /**
     * Indicates if the IDs are auto-incrementing.
     * 
     * @var bool
     */
    public $incrementing = false;

    protected $fillable = ['id', 'history_id','control_history_id','friendly_name','extension','path','created_at', 'updated_at'];


    public function __construct(){
        parent::__construct();
        $this->createIdentification();
    }


    /**
     * 
     */
    public function createIdentification(){
        $date = new DateTime();
        $this->id = md5($date->getTimestamp() . mt_rand());
    }

}
