use BookStack\App\Model;
use BookStack\App\Sluggable;
use BookStack\Entities\Tools\SlugGenerator;
+use BookStack\Translation\LocaleDefinition;
use BookStack\Translation\LocaleManager;
use BookStack\Uploads\Image;
use Carbon\Carbon;
*/
public function can(string $permissionName): bool
{
- if ($this->email === 'guest') {
- return false;
- }
-
return $this->permissions()->contains($permissionName);
}
}
try {
- $avatar = $this->avatar ? url($this->avatar->getThumb($size, $size, false)) : $default;
+ $avatar = $this->avatar?->getThumb($size, $size, false) ?? $default;
} catch (Exception $err) {
$avatar = $default;
}
}
/**
- * Get the system language for this user.
+ * Get the locale for this user.
*/
- public function getLanguage(): string
+ public function getLocale(): LocaleDefinition
{
- return app()->make(LocaleManager::class)->getForUser($this)->appLocale();
+ return app()->make(LocaleManager::class)->getForUser($this);
}
/**