<?php

namespace App\Repositories;

use Illuminate\Database\Eloquent\Model;

class Revision extends Model
{
    protected $guarded = ['id'];

    protected $appends = ['hasChanges'];

    protected $with = array('user', 'revisor');

    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function revisor()
    {
        return $this->belongsTo(User::class);
    }

    public function getHasChangesAttribute()
    {
        return $this->updated_at != $this->accepted_at;
    }
}
