1
0
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:
Daniel Klabbers
2018-04-17 14:22:38 +02:00
parent efa3b62fb8
commit a2927b725f
21 changed files with 122 additions and 106 deletions

View File

@@ -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();