| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | $fields = $this->searchable; |
| 65 | 65 | $query->where(function ($query) use ($fields, $search) { |
| 66 | 66 | $query->where(array_shift($fields), 'LIKE', "%$search%"); |
| 67 | 67 | |
| 68 | - $nameArray = explode(' ', $search); | |
| 68 | + $nameArray = explode(' ', (string) $search); | |
| 69 | 69 | if (count($nameArray) >= 2) { |
| 70 | 70 | $query->orWhere(function ($q) use ($nameArray) { |
| 71 | 71 | $fname = array_shift($nameArray); |
| 72 | 72 | $lastName = implode(' ', $nameArray); |
| @@ -121,9 +121,9 @@ | ||
| 121 | 121 | if (isset($this->attributes['last_name'])) { |
| 122 | 122 | $fallBackName .= '+' . $this->attributes['last_name']; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - $hash = md5(strtolower(trim($this->attributes['email']))); | |
| 125 | + $hash = md5(strtolower(trim($this->attributes['email'] ?? ''))); | |
| 126 | 126 | |
| 127 | 127 | $fallback = ''; |
| 128 | 128 | if ($fallBackName) { |
| 129 | 129 | $fallback = '&d=https%3A%2F%2Fui-avatars.com%2Fapi%2F' . urlencode($fallBackName) . '/128'; |
| @@ -208,9 +208,9 @@ | ||
| 208 | 208 | ->where('key', $metaKey) |
| 209 | 209 | ->first(); |
| 210 | 210 | if ($meta) { |
| 211 | 211 | $meta->value = maybe_serialize($metaValue); |
| 212 | - $meta->update(); | |
| 212 | + $meta->save(); | |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if (!$meta) { |
| 216 | 216 | Meta::create([ |
| @@ -230,13 +230,12 @@ | ||
| 230 | 230 | ->where('object_type', 'person_meta') |
| 231 | 231 | ->delete(); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - public function restoreAvatar($person, $id) | |
| 234 | + public function restoreAvatar() | |
| 235 | 235 | { |
| 236 | - $person->where('id', $id)->update([ | |
| 237 | - 'avatar' => null | |
| 238 | - ]); | |
| 236 | + $this->avatar = null; | |
| 237 | + $this->save(); | |
| 239 | 238 | |
| 240 | - return $person; | |
| 239 | + return $this; | |
| 241 | 240 | } |
| 242 | 241 | } |