Skip to content

Commit ee14446

Browse files
committed
fix a bug about extradata scope
1 parent f1ff75c commit ee14446

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/models/Admin.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ public function getSearchInExtraData($key, $query){
8888

8989
/**
9090
* add or update admin's picture.
91-
* @param $pic_base64_encoded
91+
* @param $path_or_pic_base64_encoded
9292
*/
93-
public function updateAdminPicture($pic_base64_encoded){
93+
public function updateAdminPicture($path_or_pic_base64_encoded){
9494
//use forceFill() which will bypass the mass assignment check to perform update on any JSON path,
9595
// if path is not there, it will be created and if it’s present it will be updated accordingly.
96-
$this->forceFill(['extradata->picture' => $pic_base64_encoded]);
96+
$this->forceFill(['extradata->picture' => $path_or_pic_base64_encoded]);
9797

9898
# Save the changes
9999
$this->update();
@@ -104,7 +104,7 @@ public function updateAdminPicture($pic_base64_encoded){
104104
* @return mixed
105105
*/
106106
public function getAdminPicture(){
107-
$extdata = $this->scopeGetExtraDataObj();
107+
$extdata = $this->getExtraDataObj();
108108
return $extdata->picture;
109109
}
110110

@@ -146,12 +146,11 @@ public function scopeGetExtraData($query, $key, $value){
146146
}
147147

148148
/**
149-
* Scope a query to get extradata as json object
150-
* @param $query
149+
* get extradata as json object
151150
* @return mixed
152151
*/
153-
public function scopeGetExtraDataObj($query){
154-
return json_decode($query->extradata);
152+
public function getExtraDataObj(){
153+
return json_decode($this->extradata);
155154
}
156155

157156
/**

0 commit comments

Comments
 (0)