From 7a7606742b6021859b51901240f451524243a087 Mon Sep 17 00:00:00 2001 From: Matt McDonald Date: Mon, 28 Nov 2016 11:06:59 +0000 Subject: [PATCH] More reliably detect SoftDeletes trait --- src/Userstamps.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Userstamps.php b/src/Userstamps.php index ea9fb4f..fbe05eb 100644 --- a/src/Userstamps.php +++ b/src/Userstamps.php @@ -24,13 +24,8 @@ public static function registerListeners() static::creating('Wildside\Userstamps\Listeners\Creating@handle'); static::updating('Wildside\Userstamps\Listeners\Updating@handle'); - if( method_exists(get_called_class(), 'deleting') ) - { + if (in_array('Illuminate\Database\Eloquent\SoftDeletes', class_uses(get_called_class()))) { static::deleting('Wildside\Userstamps\Listeners\Deleting@handle'); - } - - if( method_exists(get_called_class(), 'restoring') ) - { static::restoring('Wildside\Userstamps\Listeners\Restoring@handle'); } }