From 5a83c57f0f3a5f7490f6ef76c88bc166b00fdc06 Mon Sep 17 00:00:00 2001 From: Zizaco Zizuini Date: Tue, 14 Nov 2017 00:05:08 +0100 Subject: [PATCH] Updated `EntrustUserTrait` since delete & restore methods are supposed to return boolean --- src/Entrust/Traits/EntrustUserTrait.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Entrust/Traits/EntrustUserTrait.php b/src/Entrust/Traits/EntrustUserTrait.php index 72a274e8..f28f7bc5 100644 --- a/src/Entrust/Traits/EntrustUserTrait.php +++ b/src/Entrust/Traits/EntrustUserTrait.php @@ -15,7 +15,11 @@ trait EntrustUserTrait { - //Big block of caching functionality. + /** + * Big block of caching functionality. + * + * @return mixed Roles + */ public function cachedRoles() { $userPrimaryKey = $this->primaryKey; @@ -27,6 +31,10 @@ public function cachedRoles() } else return $this->roles()->get(); } + + /** + * {@inheritDoc} + */ public function save(array $options = []) { //both inserts and updates if(Cache::getStore() instanceof TaggableStore) { @@ -34,19 +42,29 @@ public function save(array $options = []) } return parent::save($options); } + + /** + * {@inheritDoc} + */ public function delete(array $options = []) { //soft or hard - parent::delete($options); + $result = parent::delete($options); if(Cache::getStore() instanceof TaggableStore) { Cache::tags(Config::get('entrust.role_user_table'))->flush(); } + return $result; } + + /** + * {@inheritDoc} + */ public function restore() { //soft delete undo's - parent::restore(); + $result = parent::restore(); if(Cache::getStore() instanceof TaggableStore) { Cache::tags(Config::get('entrust.role_user_table'))->flush(); } + return $result; } /**