<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Traits\ModelTimeFormat;

class Log extends Model
{
    use ModelTimeFormat;
    protected $fillable = [
        'operation', 'description','type', 'operator', 'ip','id_user',
    ];
    public function getUserNameAttribute(){
        $idUser=$this['id_user'];
        if($idUser){
            $user=User::find($idUser);
            return $user['name'];
        }
        return '';
    }
}
