first_name || !$this->last_name) { return null; } return "{$this->first_name} {$this->last_name}"; } public function getName() { return $this->getFullName() ?: $this->username; } public function getAvatarUrl($options = []) { $size = isset($options['size']) ? $options['size'] : 45; return 'http://www.gravatar.com/avatar/' . md5($this->email) . '?s=' . $size . '&d=identicon'; } /*public function permissions() { return $this->hasOne('Fieldprotocol\User\UserPermission', 'user_id'); } public function hasPermission($permission) { return (bool) $this->permissions->{$permission}; } public function isAdmin() { return $this->hasPermission('is_admin'); } public function isEditor() { return $this->hasPermission('is_editor'); } public function isAuthor() { return $this->hasPermission('is_author'); }*/ }