| Total Complexity | 15 |
| Total Lines | 84 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | trait UserMethod |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @return mixed |
||
| 12 | */ |
||
| 13 | public function canChangeEmail() |
||
| 14 | { |
||
| 15 | return config('access.users.change_email'); |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @return bool |
||
| 20 | */ |
||
| 21 | public function canChangePassword() |
||
| 22 | { |
||
| 23 | return ! app('session')->has(config('access.socialite_session_name')); |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @param bool $size |
||
| 28 | * |
||
| 29 | * @return bool|\Illuminate\Contracts\Routing\UrlGenerator|mixed|string |
||
| 30 | * @throws \Illuminate\Container\EntryNotFoundException |
||
| 31 | */ |
||
| 32 | public function getPicture($size = false) |
||
| 33 | { |
||
| 34 | switch ($this->avatar_type) { |
||
| 35 | case 'gravatar': |
||
| 36 | if (! $size) { |
||
| 37 | $size = config('gravatar.default.size'); |
||
| 38 | } |
||
| 39 | |||
| 40 | return gravatar()->get($this->email, ['size' => $size]); |
||
|
|
|||
| 41 | |||
| 42 | case 'storage': |
||
| 43 | return url('storage/'.$this->avatar_location); |
||
| 44 | } |
||
| 45 | |||
| 46 | $social_avatar = $this->providers()->where('provider', $this->avatar_type)->first(); |
||
| 47 | if ($social_avatar && strlen($social_avatar->avatar)) { |
||
| 48 | return $social_avatar->avatar; |
||
| 49 | } |
||
| 50 | |||
| 51 | return false; |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param $provider |
||
| 56 | * |
||
| 57 | * @return bool |
||
| 58 | */ |
||
| 59 | public function hasProvider($provider) |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return bool |
||
| 72 | */ |
||
| 73 | public function isActive() |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @return bool |
||
| 80 | */ |
||
| 81 | public function isConfirmed() |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @return bool |
||
| 88 | */ |
||
| 89 | public function isPending() |
||
| 94 |