for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Redaxscript\Model;
/**
* parent class to provide the user model
*
* @since 3.3.0
* @package Redaxscript
* @category Model
* @author Henry Ruhs
*/
class User extends ModelAbstract
{
* name of the table
* @var string
protected $_table = 'users';
* get the user by user
* @since 4.0.0
* @param string $user name of the user
* @return object|null
public function getByUser(string $user = null) : ?object
return $this->query()->where('user', $user)->findOne() ? : null;
}
* get the user by email
* @param string $email email of the user
public function getByEmail(string $email) : ?object
return $this->query()->where('email', $email)->findOne() ? : null;
* create the user by array
* @param array $createArray array of the create
* @return bool
public function createByArray(array $createArray = []) : bool
return $this
->query()
->create()
->set($createArray)
->save();
* reset the password by id
* @param int $userId identifier of the user
* @param string $password
public function resetPasswordById(int $userId = null, string $password = null) : bool
->whereIdIs($userId)
->findOne()
->set('password', $password)