public function generate($type, User $user, $hours = null)
    {
        $hours = is_null($hours) ? 24 : $hours;

        $user_id    = $user->id;
        $email      = $user->getAuthIdentifier();
        $value      = str_shuffle(sha1($email . $type . spl_object_hash($this) . microtime(true)));
        $token      = hash_hmac('sha256', $value, config('app.key'));
        $expires_at = Carbon::now()->addHours($hours);

        return $this->create(compact('user_id', 'type', 'token', 'expires_at'));
    }
public function generate($type, User $user, $hours = null)
    {
        $hours = is_null($hours) ? 24 : $hours;

        $user_id    = $user->id;
        $email      = $user->getAuthIdentifier();
        $value      = str_shuffle(sha1($email . $type . spl_object_hash($this) . microtime(true)));
        $token      = hash_hmac('sha256', $value, config('app.key'));
        $expires_at = Carbon::now()->addHours($hours);

        return $this->create(compact('user_id', 'type', 'token', 'expires_at'));
    }
public function generate ( $ type , User $ user , $ hours = null ) { $ hours = is_null ( $ hours ) ? 24 : $ hours ; $ user_id = $ user -> id ; $ email = $ user -> getAuthIdentifier ( ) ; $ value = str_shuffle ( sha1 ( $ email . $ type . spl_object_hash ( $ this ) . microtime ( true ) ) ) ; $ token = hash_hmac ( 'sha256' , $ value , config ( 'app.key' ) ) ; $ expires_at = Carbon :: now ( ) -> addHours ( $ hours ) ; return $ this -> create ( compact ( 'user_id' , 'type' , 'token' , 'expires_at' ) ) ; }
Generate a new token for the type.

@param string           $type
@param \App\Models\User $user
@param null|int         $hours

@return $this
Generate a new token for the type .