Upgrade to 3.2.0
This commit is contained in:
@@ -4,16 +4,21 @@ namespace Kirby\Cms;
|
||||
|
||||
use Closure;
|
||||
use Kirby\Data\Data;
|
||||
use Kirby\Exception\DuplicateException;
|
||||
use Kirby\Exception\Exception;
|
||||
use Kirby\Exception\InvalidArgumentLogicException;
|
||||
use Kirby\Exception\LogicException;
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Toolkit\Dir;
|
||||
use Kirby\Toolkit\F;
|
||||
use Kirby\Toolkit\Str;
|
||||
use Kirby\Toolkit\V;
|
||||
|
||||
/**
|
||||
* UserActions
|
||||
*
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
trait UserActions
|
||||
{
|
||||
|
||||
@@ -23,7 +28,7 @@ trait UserActions
|
||||
* @param string $email
|
||||
* @return self
|
||||
*/
|
||||
public function changeEmail(string $email): self
|
||||
public function changeEmail(string $email)
|
||||
{
|
||||
return $this->commit('changeEmail', [$this, $email], function ($user, $email) {
|
||||
$user = $user->clone([
|
||||
@@ -44,7 +49,7 @@ trait UserActions
|
||||
* @param string $language
|
||||
* @return self
|
||||
*/
|
||||
public function changeLanguage(string $language): self
|
||||
public function changeLanguage(string $language)
|
||||
{
|
||||
return $this->commit('changeLanguage', [$this, $language], function ($user, $language) {
|
||||
$user = $user->clone([
|
||||
@@ -65,7 +70,7 @@ trait UserActions
|
||||
* @param string $name
|
||||
* @return self
|
||||
*/
|
||||
public function changeName(string $name): self
|
||||
public function changeName(string $name)
|
||||
{
|
||||
return $this->commit('changeName', [$this, $name], function ($user, $name) {
|
||||
$user = $user->clone([
|
||||
@@ -86,7 +91,7 @@ trait UserActions
|
||||
* @param string $password
|
||||
* @return self
|
||||
*/
|
||||
public function changePassword(string $password): self
|
||||
public function changePassword(string $password)
|
||||
{
|
||||
return $this->commit('changePassword', [$this, $password], function ($user, $password) {
|
||||
$user = $user->clone([
|
||||
@@ -105,7 +110,7 @@ trait UserActions
|
||||
* @param string $role
|
||||
* @return self
|
||||
*/
|
||||
public function changeRole(string $role): self
|
||||
public function changeRole(string $role)
|
||||
{
|
||||
return $this->commit('changeRole', [$this, $role], function ($user, $role) {
|
||||
$user = $user->clone([
|
||||
@@ -156,7 +161,7 @@ trait UserActions
|
||||
* @param array $input
|
||||
* @return self
|
||||
*/
|
||||
public static function create(array $props = null): self
|
||||
public static function create(array $props = null)
|
||||
{
|
||||
$data = $props;
|
||||
|
||||
@@ -164,7 +169,9 @@ trait UserActions
|
||||
$data['password'] = static::hashPassword($props['password']);
|
||||
}
|
||||
|
||||
$user = new static($data);
|
||||
$props['role'] = $props['model'] = strtolower($props['role'] ?? 'default');
|
||||
|
||||
$user = User::factory($data);
|
||||
|
||||
// create a form for the user
|
||||
$form = Form::for($user, [
|
||||
|
Reference in New Issue
Block a user