From 7c3991c253ef2a5188a915d5246f9c1c43892017 Mon Sep 17 00:00:00 2001 From: sambadi Date: Tue, 8 Mar 2016 22:44:00 +0300 Subject: [PATCH] Fix EntrustRoleTrait Fix save/delete/restore methods to return value as it designed in "Illuminate\Database\Eloquent\Model" and "Illuminate\Database\Eloquent\SoftDeletes" This restore expected behavior of save/delete/restore methods in inherited classes --- src/Entrust/Traits/EntrustRoleTrait.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Entrust/Traits/EntrustRoleTrait.php b/src/Entrust/Traits/EntrustRoleTrait.php index 9907b5e8..cd32d19d 100644 --- a/src/Entrust/Traits/EntrustRoleTrait.php +++ b/src/Entrust/Traits/EntrustRoleTrait.php @@ -24,18 +24,27 @@ public function cachedPermissions() } public function save(array $options = []) { //both inserts and updates - parent::save($options); + if(!parent::save($options)){ + return false; + } Cache::tags(Config::get('entrust.permission_role_table'))->flush(); + return true; } public function delete(array $options = []) { //soft or hard - parent::delete($options); + if(!parent::delete($options)){ + return false; + } Cache::tags(Config::get('entrust.permission_role_table'))->flush(); + return true; } public function restore() { //soft delete undo's - parent::restore(); + if(!parent::restore()){ + return false; + } Cache::tags(Config::get('entrust.permission_role_table'))->flush(); + return true; } /**