josh18
131
8
Laravel

Get a password reset token

Posted 3 years ago by josh18

I'm trying to access the create function inside of Illuminate\Auth\Passwords\DatabaseTokenRepository but I'm not sure of the best way to do this.

I'm new to Laravel so please forgive me if there is an obvious answer to this, I have done a lot of research but I just can't seem to find anything. The closest I've come is to create a facade in Illuminate/Support/Facades which looks like:

<?php

namespace Illuminate\Support\Facades;

/**
 * @see \Illuminate\Auth\Passwords\DatabaseTokenRepository
 */
class PasswordToken extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'auth.password.tokens';
    }
}

and then adding 'PasswordToken' => Illuminate\Support\Facades\PasswordToken::class to config/app.php. This then lets me do $token = PasswordToken::create($user);

Am I even close to doing this the right way?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.