Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 303 Bytes

eloquent-trait-detects-edits.md

File metadata and controls

18 lines (14 loc) · 303 Bytes
<?php declare(strict_types=1);

namespace App\Traits;

trait DetectsEdits{

    /**
     * Get Was Edited Conditional
     * @return mixed
     */
    public function getWasEditedAttribute(): bool
    {
        return optional($this->created_at)->notEqualTo($this->updated_at) || false;
    }
}