public function sendResetPasswordEmail(array $conditions)
    {
        // Validate conditions
        if (empty($conditions)) {
            throw new ResetPasswordNoUserException('Conditions can\'t be empty');
        }

        // Add conditions to query builder
        foreach ($conditions as $column => $value) {
            $this->authModel = $this->authModel->where($column, '=', $value);
        }

        // Retrieve user with conditions
        $user = $this->authModel->first();
        if (empty($user)) {
            throw new ResetPasswordNoUserException('Could not find any user with those credentials');
        }

        // Generate reset password token
        $token = $this->generateResetPasswordToken($user);

        // Generate reset password domain
        $domain = env('NODES_ENV', false) ? sprintf('https://%s.%s', env('APP_NAME'), env('APP_DOMAIN')) : config('app.url');

        // Send e-mail with instructions on how to reset password
        Mail::send([
            'html' => config('nodes.api.reset-password.views.html', 'nodes.api::reset-password.emails.html'),
            'text' => config('nodes.api.reset-password.views.text', 'nodes.api::reset-password.emails.text'),
        ], [
            'user' => $user,
            'domain' => $domain,
            'token' => $token,
            'expire' => config('nodes.api.reset-password.expire'),
            'senderName' => (config('nodes.api.reset-password.from.name') != 'Nodes') ? config('nodes.api.reset-password.from.name') : config('nodes.project.name'),
        ], function ($message) use ($user) {
            $message->to($user->email)
                    ->from(config('nodes.api.reset-password.from.email', 'no-reply@nodes.dk'), config('nodes.api.reset-password.from.name', 'Nodes'))
                    ->subject(config('nodes.api.reset-password.subject', 'Reset password request'));
        });
    }
public function sendResetPasswordEmail(array $conditions)
    {
        // Validate conditions
        if (empty($conditions)) {
            throw new ResetPasswordNoUserException('Conditions can\'t be empty');
        }

        // Add conditions to query builder
        foreach ($conditions as $column => $value) {
            $this->authModel = $this->authModel->where($column, '=', $value);
        }

        // Retrieve user with conditions
        $user = $this->authModel->first();
        if (empty($user)) {
            throw new ResetPasswordNoUserException('Could not find any user with those credentials');
        }

        // Generate reset password token
        $token = $this->generateResetPasswordToken($user);

        // Generate reset password domain
        $domain = env('NODES_ENV', false) ? sprintf('https://%s.%s', env('APP_NAME'), env('APP_DOMAIN')) : config('app.url');

        // Send e-mail with instructions on how to reset password
        Mail::send([
            'html' => config('nodes.api.reset-password.views.html', 'nodes.api::reset-password.emails.html'),
            'text' => config('nodes.api.reset-password.views.text', 'nodes.api::reset-password.emails.text'),
        ], [
            'user' => $user,
            'domain' => $domain,
            'token' => $token,
            'expire' => config('nodes.api.reset-password.expire'),
            'senderName' => (config('nodes.api.reset-password.from.name') != 'Nodes') ? config('nodes.api.reset-password.from.name') : config('nodes.project.name'),
        ], function ($message) use ($user) {
            $message->to($user->email)
                    ->from(config('nodes.api.reset-password.from.email', 'no-reply@nodes.dk'), config('nodes.api.reset-password.from.name', 'Nodes'))
                    ->subject(config('nodes.api.reset-password.subject', 'Reset password request'));
        });
    }
public function sendResetPasswordEmail ( array $ conditions ) { // Validate conditions if ( empty ( $ conditions ) ) { throw new ResetPasswordNoUserException ( 'Conditions can\'t be empty' ) ; } // Add conditions to query builder foreach ( $ conditions as $ column => $ value ) { $ this -> authModel = $ this -> authModel -> where ( $ column , '=' , $ value ) ; } // Retrieve user with conditions $ user = $ this -> authModel -> first ( ) ; if ( empty ( $ user ) ) { throw new ResetPasswordNoUserException ( 'Could not find any user with those credentials' ) ; } // Generate reset password token $ token = $ this -> generateResetPasswordToken ( $ user ) ; // Generate reset password domain $ domain = env ( 'NODES_ENV' , false ) ? sprintf ( 'https://%s.%s' , env ( 'APP_NAME' ) , env ( 'APP_DOMAIN' ) ) : config ( 'app.url' ) ; // Send e-mail with instructions on how to reset password Mail :: send ( [ 'html' => config ( 'nodes.api.reset-password.views.html' , 'nodes.api::reset-password.emails.html' ) , 'text' => config ( 'nodes.api.reset-password.views.text' , 'nodes.api::reset-password.emails.text' ) , ] , [ 'user' => $ user , 'domain' => $ domain , 'token' => $ token , 'expire' => config ( 'nodes.api.reset-password.expire' ) , 'senderName' => ( config ( 'nodes.api.reset-password.from.name' ) != 'Nodes' ) ? config ( 'nodes.api.reset-password.from.name' ) : config ( 'nodes.project.name' ) , ] , function ( $ message ) use ( $ user ) { $ message -> to ( $ user -> email ) -> from ( config ( 'nodes.api.reset-password.from.email' , 'no-reply@nodes.dk' ) , config ( 'nodes.api.reset-password.from.name' , 'Nodes' ) ) -> subject ( config ( 'nodes.api.reset-password.subject' , 'Reset password request' ) ) ; } ) ; }
Generate and send a email with reset password instructions.

@author Morten Rugaard <moru@nodes.dk>

@param  array $conditions WHERE conditions to locate user. Format: ['column' => 'value']
@throws \Nodes\Api\Auth\Exceptions\ResetPasswordNoUserException
Generate and send a email with reset password instructions .