Upgrade to 3.1.2
This commit is contained in:
@@ -160,6 +160,10 @@ class App
|
||||
*/
|
||||
public function api(): Api
|
||||
{
|
||||
if ($this->api !== null) {
|
||||
return $this->api;
|
||||
}
|
||||
|
||||
$root = static::$root . '/config/api';
|
||||
$extensions = $this->extensions['api'] ?? [];
|
||||
$routes = (include $root . '/routes.php')($this);
|
||||
@@ -174,7 +178,7 @@ class App
|
||||
'kirby' => $this,
|
||||
];
|
||||
|
||||
return $this->api = $this->api ?? new Api($api);
|
||||
return $this->api = new Api($api);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,7 +258,7 @@ class App
|
||||
* automatically injected
|
||||
*
|
||||
* @param string $name
|
||||
* @return void
|
||||
* @return Kirby\Cms\Collection|null
|
||||
*/
|
||||
public function collection(string $name)
|
||||
{
|
||||
@@ -682,7 +686,7 @@ class App
|
||||
*/
|
||||
public function markdown(string $text = null, bool $inline = false): string
|
||||
{
|
||||
return $this->extensions['components']['markdown']($this, $text, $this->options['markdown'] ?? [], $inline);
|
||||
return $this->component('markdown')($this, $text, $this->options['markdown'] ?? [], $inline);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1091,7 +1095,7 @@ class App
|
||||
*/
|
||||
public function smartypants(string $text = null): string
|
||||
{
|
||||
return $this->extensions['components']['smartypants']($this, $text, $this->options['smartypants'] ?? []);
|
||||
return $this->component('smartypants')($this, $text, $this->options['smartypants'] ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1103,7 +1107,7 @@ class App
|
||||
*/
|
||||
public function snippet(string $name, array $data = []): ?string
|
||||
{
|
||||
return $this->extensions['components']['snippet']($this, $name, array_merge($this->data, $data));
|
||||
return $this->component('snippet')($this, $name, array_merge($this->data, $data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1125,7 +1129,7 @@ class App
|
||||
*/
|
||||
public function template(string $name, string $type = 'html', string $defaultType = 'html'): Template
|
||||
{
|
||||
return $this->extensions['components']['template']($this, $name, $type, $defaultType);
|
||||
return $this->component('template')($this, $name, $type, $defaultType);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1134,11 +1138,11 @@ class App
|
||||
* @param string $src
|
||||
* @param string $dst
|
||||
* @param array $options
|
||||
* @return null
|
||||
* @return string
|
||||
*/
|
||||
public function thumb(string $src, string $dst, array $options = [])
|
||||
public function thumb(string $src, string $dst, array $options = []): string
|
||||
{
|
||||
return $this->extensions['components']['thumb']($this, $src, $dst, $options);
|
||||
return $this->component('thumb')($this, $src, $dst, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -86,6 +86,10 @@ trait AppPlugins
|
||||
protected function extendApi($api): array
|
||||
{
|
||||
if (is_array($api) === true) {
|
||||
if (is_a($api['routes'] ?? [], Closure::class) === true) {
|
||||
$api['routes'] = $api['routes']($this);
|
||||
}
|
||||
|
||||
return $this->extensions['api'] = A::merge($this->extensions['api'], $api, A::MERGE_APPEND);
|
||||
} else {
|
||||
return $this->extensions['api'];
|
||||
@@ -363,6 +367,7 @@ trait AppPlugins
|
||||
protected function extensionsFromSystem()
|
||||
{
|
||||
// Form Field Mixins
|
||||
FormField::$mixins['min'] = include static::$root . '/config/fields/mixins/min.php';
|
||||
FormField::$mixins['options'] = include static::$root . '/config/fields/mixins/options.php';
|
||||
|
||||
// Tag Aliases
|
||||
|
||||
@@ -79,6 +79,48 @@ class Content
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the content to a new blueprint
|
||||
*
|
||||
* @param string $to
|
||||
* @return array
|
||||
*/
|
||||
public function convertTo(string $to): array
|
||||
{
|
||||
// prepare data
|
||||
$data = [];
|
||||
$content = $this;
|
||||
|
||||
// blueprints
|
||||
$old = $this->parent->blueprint();
|
||||
$subfolder = dirname($old->name());
|
||||
$new = Blueprint::factory($subfolder . '/' . $to, $subfolder . '/default', $this->parent);
|
||||
|
||||
// forms
|
||||
$oldForm = new Form(['fields' => $old->fields(), 'model' => $this->parent]);
|
||||
$newForm = new Form(['fields' => $new->fields(), 'model' => $this->parent]);
|
||||
|
||||
// fields
|
||||
$oldFields = $oldForm->fields();
|
||||
$newFields = $newForm->fields();
|
||||
|
||||
// go through all fields of new template
|
||||
foreach ($newFields as $newField) {
|
||||
$name = $newField->name();
|
||||
$oldField = $oldFields->get($name);
|
||||
|
||||
// field name and type matches with old template
|
||||
if ($oldField && $oldField->type() === $newField->type()) {
|
||||
$data[$name] = $content->get($name)->value();
|
||||
} else {
|
||||
$data[$name] = $newField->default();
|
||||
}
|
||||
}
|
||||
|
||||
// preserve existing fields
|
||||
return array_merge($this->data, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the raw data array
|
||||
*
|
||||
|
||||
@@ -75,12 +75,16 @@ class Email
|
||||
$html = $this->getTemplate($this->props['template'], 'html');
|
||||
$text = $this->getTemplate($this->props['template'], 'text');
|
||||
|
||||
if ($html->exists() && $text->exists()) {
|
||||
if ($html->exists()) {
|
||||
$this->props['body'] = [
|
||||
'html' => $html->render($data),
|
||||
'text' => $text->render($data),
|
||||
'html' => $html->render($data)
|
||||
];
|
||||
// fallback to single email text template
|
||||
|
||||
if ($text->exists()) {
|
||||
$this->props['body']['text'] = $text->render($data);
|
||||
}
|
||||
|
||||
// fallback to single email text template
|
||||
} elseif ($text->exists()) {
|
||||
$this->props['body'] = $text->render($data);
|
||||
} else {
|
||||
|
||||
@@ -367,6 +367,28 @@ class File extends ModelWithContent
|
||||
return $this->parent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the file's last modification time.
|
||||
*
|
||||
* @param string $format
|
||||
* @param string|null $handler date or strftime
|
||||
* @return mixed
|
||||
*/
|
||||
public function modified(string $format = null, string $handler = null)
|
||||
{
|
||||
$file = F::modified($this->root());
|
||||
$content = F::modified($this->contentFile());
|
||||
$modified = max($file, $content);
|
||||
|
||||
if (is_null($format) === true) {
|
||||
return $modified;
|
||||
}
|
||||
|
||||
$handler = $handler ?? $this->kirby()->option('date.handler', 'date');
|
||||
|
||||
return $handler($format, $modified);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the parent Page object
|
||||
*
|
||||
@@ -418,14 +440,12 @@ class File extends ModelWithContent
|
||||
|
||||
$definition = array_merge($types[$this->type()] ?? [], $extensions[$this->extension()] ?? []);
|
||||
|
||||
$settings = [
|
||||
return [
|
||||
'type' => $definition['type'] ?? 'file',
|
||||
'back' => 'pattern',
|
||||
'color' => $definition['color'] ?? $colorWhite,
|
||||
'back' => $params['back'] ?? 'pattern',
|
||||
'ratio' => $params['ratio'] ?? null,
|
||||
];
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -745,6 +765,6 @@ class File extends ModelWithContent
|
||||
*/
|
||||
public function url(): string
|
||||
{
|
||||
return $this->url ?? $this->url = $this->kirby()->component('file::url')($this->kirby(), $this, []);
|
||||
return $this->url ?? $this->url = $this->kirby()->component('file::url')($this->kirby(), $this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,8 +205,7 @@ trait FileActions
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for changeName
|
||||
* @deprecated
|
||||
* @deprecated 3.0.0 Use `File::changeName()` instead
|
||||
*
|
||||
* @param string $name
|
||||
* @param bool $sanitize
|
||||
|
||||
@@ -55,17 +55,16 @@ class Files extends Collection
|
||||
* Sort all given files by the
|
||||
* order in the array
|
||||
*
|
||||
* @param array $files
|
||||
* @param array $files List of filenames
|
||||
* @param int $offset Sorting offset
|
||||
* @return self
|
||||
*/
|
||||
public function changeSort(array $files)
|
||||
public function changeSort(array $files, int $offset = 0)
|
||||
{
|
||||
$index = 0;
|
||||
|
||||
foreach ($files as $filename) {
|
||||
if ($file = $this->get($filename)) {
|
||||
$index++;
|
||||
$file->changeSort($index);
|
||||
$offset++;
|
||||
$file->changeSort($offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Kirby\Cms;
|
||||
|
||||
use Kirby\Data\Data;
|
||||
use Kirby\Exception\DuplicateException;
|
||||
use Kirby\Exception\Exception;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
@@ -9,6 +10,7 @@ use Kirby\Exception\LogicException;
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* The `$language` object represents
|
||||
@@ -318,7 +320,11 @@ class Language extends Model
|
||||
*/
|
||||
public function pattern(): string
|
||||
{
|
||||
return $this->url;
|
||||
if (empty($this->url) === true) {
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
return trim($this->url, '/');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,13 +345,27 @@ class Language extends Model
|
||||
*/
|
||||
public function save(): self
|
||||
{
|
||||
$data = $this->toArray();
|
||||
try {
|
||||
$existingData = Data::read($this->root());
|
||||
} catch (Throwable $e) {
|
||||
$existingData = [];
|
||||
}
|
||||
|
||||
unset($data['url']);
|
||||
$props = [
|
||||
'code' => $this->code(),
|
||||
'default' => $this->isDefault(),
|
||||
'direction' => $this->direction(),
|
||||
'locale' => $this->locale(),
|
||||
'name' => $this->name(),
|
||||
'translations' => $this->translations(),
|
||||
'url' => $this->url,
|
||||
];
|
||||
|
||||
$export = '<?php' . PHP_EOL . PHP_EOL . 'return ' . var_export($data, true) . ';';
|
||||
$data = array_merge($existingData, $props);
|
||||
|
||||
F::write($this->root(), $export);
|
||||
ksort($data);
|
||||
|
||||
Data::write($this->root(), $data);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -416,7 +436,7 @@ class Language extends Model
|
||||
*/
|
||||
protected function setUrl(string $url = null): self
|
||||
{
|
||||
$this->url = $url !== null ? trim($url, '/') : $this->code;
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -455,7 +475,7 @@ class Language extends Model
|
||||
*/
|
||||
public function url(): string
|
||||
{
|
||||
return Url::to($this->url);
|
||||
return Url::to($this->pattern());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,6 +6,7 @@ use Closure;
|
||||
use Kirby\Data\Data;
|
||||
use Kirby\Exception\Exception;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Http\Uri;
|
||||
use Kirby\Toolkit\A;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\Str;
|
||||
@@ -579,8 +580,18 @@ class Page extends ModelWithContent
|
||||
// inspect the current request
|
||||
$request = $kirby->request();
|
||||
|
||||
// disable the pages cache for any request types but GET or HEAD or special data
|
||||
if (in_array($request->method(), ['GET', 'HEAD']) === false || empty($request->data()) === false) {
|
||||
// disable the pages cache for any request types but GET or HEAD
|
||||
if (in_array($request->method(), ['GET', 'HEAD']) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// disable the pages cache when there's request data
|
||||
if (empty($request->data()) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// disable the pages cache when there are any params
|
||||
if ($request->params()->isNotEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -875,30 +886,21 @@ class Page extends ModelWithContent
|
||||
*/
|
||||
public function panelIcon(array $params = null): array
|
||||
{
|
||||
$options = [
|
||||
'type' => 'page',
|
||||
'ratio' => $params['ratio'] ?? null,
|
||||
'back' => $params['back'] ?? 'black',
|
||||
];
|
||||
|
||||
if ($icon = $this->blueprint()->icon()) {
|
||||
$options['type'] = $icon;
|
||||
|
||||
// check for emojis
|
||||
if (strlen($icon) !== Str::length($icon)) {
|
||||
$options = [
|
||||
'type' => $icon,
|
||||
'back' => 'black',
|
||||
'emoji' => true
|
||||
];
|
||||
} else {
|
||||
$options = [
|
||||
'type' => $icon,
|
||||
'back' => 'black',
|
||||
];
|
||||
$options['emoji'] = true;
|
||||
}
|
||||
} else {
|
||||
$options = [
|
||||
'type' => 'page',
|
||||
'back' => 'black',
|
||||
];
|
||||
}
|
||||
|
||||
$options['ratio'] = $params['ratio'] ?? null;
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
@@ -1062,7 +1064,10 @@ class Page extends ModelWithContent
|
||||
}
|
||||
|
||||
if ($this->isDraft() === true) {
|
||||
$url .= '?token=' . $this->token();
|
||||
$uri = new Uri($url);
|
||||
$uri->query->token = $this->token();
|
||||
|
||||
$url = $uri->toString();
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
||||
@@ -29,6 +29,11 @@ trait PageActions
|
||||
throw new LogicException('Drafts cannot change their sorting number');
|
||||
}
|
||||
|
||||
// don't run the action if everything stayed the same
|
||||
if ($this->num() === $num) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
return $this->commit('changeNum', [$this, $num], function ($oldPage, $num) {
|
||||
$newPage = $oldPage->clone([
|
||||
'num' => $num,
|
||||
@@ -213,24 +218,19 @@ trait PageActions
|
||||
return $this;
|
||||
}
|
||||
|
||||
// prepare data to transfer between blueprints
|
||||
$oldBlueprint = 'pages/' . $this->template();
|
||||
$newBlueprint = 'pages/' . $template;
|
||||
|
||||
return $this->commit('changeTemplate', [$this, $template], function ($oldPage, $template) use ($oldBlueprint, $newBlueprint) {
|
||||
return $this->commit('changeTemplate', [$this, $template], function ($oldPage, $template) {
|
||||
if ($this->kirby()->multilang() === true) {
|
||||
$newPage = $this->clone([
|
||||
'template' => $template
|
||||
]);
|
||||
|
||||
foreach ($this->kirby()->languages()->codes() as $code) {
|
||||
$content = $oldPage->content($code)->convertTo($template);
|
||||
|
||||
if (F::remove($oldPage->contentFile($code)) !== true) {
|
||||
throw new LogicException('The old text file could not be removed');
|
||||
}
|
||||
|
||||
// convert the content to the new blueprint
|
||||
$content = $oldPage->transferData($oldPage->content($code), $oldBlueprint, $newBlueprint)['data'];
|
||||
|
||||
// save the language file
|
||||
$newPage->save($content, $code);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ trait PageActions
|
||||
return $newPage->clone();
|
||||
} else {
|
||||
$newPage = $this->clone([
|
||||
'content' => $this->transferData($this->content(), $oldBlueprint, $newBlueprint)['data'],
|
||||
'content' => $this->content()->convertTo($template),
|
||||
'template' => $template
|
||||
]);
|
||||
|
||||
@@ -596,79 +596,6 @@ trait PageActions
|
||||
return $this->changeStatus('listed', $position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfers data from old to new blueprint and tracks changes
|
||||
*
|
||||
* @param Content $content
|
||||
* @param string $old Old blueprint
|
||||
* @param string $new New blueprint
|
||||
* @return array
|
||||
*/
|
||||
protected function transferData(Content $content, string $old, string $new): array
|
||||
{
|
||||
// Prepare data
|
||||
$data = [];
|
||||
$old = Blueprint::factory($old, 'pages/default', $this);
|
||||
$new = Blueprint::factory($new, 'pages/default', $this);
|
||||
$oldForm = new Form(['fields' => $old->fields(), 'model' => $this]);
|
||||
$newForm = new Form(['fields' => $new->fields(), 'model' => $this]);
|
||||
$oldFields = $oldForm->fields();
|
||||
$newFields = $newForm->fields();
|
||||
|
||||
// Tracking changes
|
||||
$added = [];
|
||||
$replaced = [];
|
||||
$removed = [];
|
||||
|
||||
// Ensure to keep title
|
||||
$data['title'] = $content->get('title')->value();
|
||||
|
||||
// Go through all fields of new template
|
||||
foreach ($newFields as $newField) {
|
||||
$name = $newField->name();
|
||||
$oldField = $oldFields->get($name);
|
||||
|
||||
// Field name matches with old template
|
||||
if ($oldField !== null) {
|
||||
|
||||
// Same field type, add and keep value
|
||||
if ($oldField->type() === $newField->type()) {
|
||||
$data[$name] = $content->get($name)->value();
|
||||
|
||||
// Different field type, add with empty value
|
||||
} else {
|
||||
$data[$name] = null;
|
||||
$replaced[$name] = $oldFields->get($name)->label() ?? $name;
|
||||
}
|
||||
|
||||
// Field does not exist in old template,
|
||||
// add with empty or preserved value
|
||||
} else {
|
||||
$preserved = $content->get($name);
|
||||
$data[$name] = $preserved ? $preserved->value(): null;
|
||||
$added[$name] = $newField->label() ?? $name;
|
||||
}
|
||||
}
|
||||
|
||||
// Go through all values to preserve them
|
||||
foreach ($content->fields() as $field) {
|
||||
$name = $field->key();
|
||||
$newField = $newFields->get($name);
|
||||
|
||||
if ($newField === null) {
|
||||
$data[$name] = $field->value();
|
||||
$removed[$name] = $field->name();
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'data' => $data,
|
||||
'added' => $added,
|
||||
'replaced' => $replaced,
|
||||
'removed' => $removed
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a page from listed or
|
||||
* unlisted to draft.
|
||||
|
||||
@@ -26,7 +26,7 @@ trait PageSiblings
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Page::hasNextListed` instead
|
||||
* @deprecated 3.0.0 Use `Page::hasNextListed` instead
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasNextVisible(): bool
|
||||
@@ -46,7 +46,7 @@ trait PageSiblings
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Page::hasPrevUnlisted` instead
|
||||
* @deprecated 3.0.0 Use `Page::hasPrevUnlisted` instead
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasPrevInvisible(): bool
|
||||
@@ -77,7 +77,7 @@ trait PageSiblings
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Page::hasPrevListed instead`
|
||||
* @deprecated 3.0.0 Use `Page::hasPrevListed instead`
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasPrevVisible(): bool
|
||||
@@ -86,7 +86,7 @@ trait PageSiblings
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Page::nextUnlisted()` instead
|
||||
* @deprecated 3.0.0 Use `Page::nextUnlisted()` instead
|
||||
* @return self|null
|
||||
*/
|
||||
public function nextInvisible()
|
||||
@@ -115,7 +115,7 @@ trait PageSiblings
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Page::prevListed()` instead
|
||||
* @deprecated 3.0.0 Use `Page::prevListed()` instead
|
||||
* @return self|null
|
||||
*/
|
||||
public function nextVisible()
|
||||
@@ -124,7 +124,7 @@ trait PageSiblings
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Page::prevUnlisted()` instead
|
||||
* @deprecated 3.0.0 Use `Page::prevUnlisted()` instead
|
||||
* @return self|null
|
||||
*/
|
||||
public function prevInvisible()
|
||||
@@ -153,7 +153,7 @@ trait PageSiblings
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Page::prevListed()` instead
|
||||
* @deprecated 3.0.0 Use `Page::prevListed()` instead
|
||||
* @return self|null
|
||||
*/
|
||||
public function prevVisible()
|
||||
|
||||
@@ -69,7 +69,8 @@ class Search
|
||||
}
|
||||
|
||||
if (empty($options['fields']) === false) {
|
||||
$keys = array_intersect($keys, $options['fields']);
|
||||
$fields = array_map('strtolower', $options['fields']);
|
||||
$keys = array_intersect($keys, $fields);
|
||||
}
|
||||
|
||||
$item->searchHits = 0;
|
||||
|
||||
@@ -80,12 +80,8 @@ class Url extends BaseUrl
|
||||
$path = $page->url($language);
|
||||
}
|
||||
|
||||
if ($handler = $kirby->component('url')) {
|
||||
return $handler($kirby, $path, $options, function (string $path = null, $options = null) {
|
||||
return parent::to($path, $options);
|
||||
});
|
||||
}
|
||||
|
||||
return parent::to($path, $options);
|
||||
return $kirby->component('url')($kirby, $path, $options, function (string $path = null, $options = null) {
|
||||
return parent::to($path, $options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,11 +292,15 @@ class User extends ModelWithContent
|
||||
/**
|
||||
* Compares the current object with the given user object
|
||||
*
|
||||
* @param User $user
|
||||
* @param User|null $user
|
||||
* @return bool
|
||||
*/
|
||||
public function is(User $user): bool
|
||||
public function is(User $user = null): bool
|
||||
{
|
||||
if ($user === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->id() === $user->id();
|
||||
}
|
||||
|
||||
|
||||
@@ -185,8 +185,15 @@ trait UserActions
|
||||
|
||||
$user->writePassword($user->password());
|
||||
|
||||
// always create users in the default language
|
||||
if ($user->kirby()->multilang() === true) {
|
||||
$languageCode = $user->kirby()->defaultLanguage()->code();
|
||||
} else {
|
||||
$languageCode = null;
|
||||
}
|
||||
|
||||
// write the user data
|
||||
return $user->save();
|
||||
return $user->save($user->content()->toArray(), $languageCode);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ class Users extends Collection
|
||||
public function findByKey($key)
|
||||
{
|
||||
if (Str::contains($key, '@') === true) {
|
||||
return parent::findBy('email', $key);
|
||||
return parent::findBy('email', strtolower($key));
|
||||
}
|
||||
|
||||
return parent::findByKey($key);
|
||||
|
||||
Reference in New Issue
Block a user