mirror of
https://github.com/flarum/core.git
synced 2025-10-20 03:06:07 +02:00
went over most of the changed attributes from the other pr
This commit is contained in:
@@ -14,7 +14,9 @@ namespace Flarum\User;
|
||||
use Flarum\Database\AbstractModel;
|
||||
|
||||
/**
|
||||
* @todo document database columns with @property
|
||||
* @property string $token
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property int $user_id
|
||||
*/
|
||||
class PasswordToken extends AbstractModel
|
||||
{
|
||||
@@ -35,17 +37,22 @@ class PasswordToken extends AbstractModel
|
||||
*/
|
||||
public $incrementing = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $primaryKey = 'token';
|
||||
|
||||
/**
|
||||
* Generate a password token for the specified user.
|
||||
*
|
||||
* @param int $userId
|
||||
* @return static
|
||||
*/
|
||||
public static function generate($userId)
|
||||
public static function generate(int $userId)
|
||||
{
|
||||
$token = new static;
|
||||
|
||||
$token->id = str_random(40);
|
||||
$token->token = str_random(40);
|
||||
$token->user_id = $userId;
|
||||
$token->created_at = time();
|
||||
|
||||
|
Reference in New Issue
Block a user