2017 © Pedro Peláez
 

library laravel-registrar

User account activation via email confirmation for Laravel.

image

genealabs/laravel-registrar

User account activation via email confirmation for Laravel.

  • Thursday, July 26, 2018
  • by mikebronner
  • Repository
  • 1 Watchers
  • 10 Stars
  • 304 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 8 Versions
  • 26 % Grown

The README.md

This package is retired as of Laravel 5.7. Please use Laravel's Email Verification functionality: https://laravel.com/docs/5.7/verification

Registrar for Laravel

Join the chat at https://gitter.im/GeneaLabs/laravel-registrar, (*1)

User account activation via email confirmation for Laravel., (*2)

Features

  • Account activation through email verification.
  • Blocks logins until account is activated.
  • Uses Laravel Notifications to send out emails.

Reasoning

After having set up email activations on a few projects now, it became clear that this is something that is going to be used more often, warranting extraction to a package for easy reuse with minimal coding., (*3)

Requirements

  • PHP 7.0.0+
  • Laravel 5.3

Installation

Install the package using the following command:, (*4)

composer require genealabs/laravel-registrar

Add the service provider to you app config file /config/app.php:, (*5)

GeneaLabs\LaravelRegistrar\Providers\LaravelRegistrarService::class,

Add the following trait to your login controller /app/Http/Controllers/Auth/LoginController.php:, (*6)

use GeneaLabs\LaravelRegistrar\Traits\ActivatesUsers;

//class LoginController extends Controller
//{
    use ActivatesUsers {
        ActivatesUsers::attemptLogin insteadof AuthenticatesUsers;
    }

And finally, add this trait to your User model:, (*7)

use GeneaLabs\LaravelRegistrar\Traits\Activatable;

//class User
//{
 use Activatable;

Usage

Each time a new user is created, an activation token will be added to their record and an email activation notification sent out with a link that will activate their user account by removing the activation token and setting the activation timestamp. The user will then be able to log into their account., (*8)

Conditional Activation Notices

To send out the notification email only when a certain condition is met, override the getCanBeActivatedAttribute() method in your User class. By default this method returns true, unless you override it., (*9)

public function getCanBeActivatedAttribute() : bool
{
    // return true or false based on your specific condition.
}

Customization

You can customize the notification email by implementing your own Notification class, then overriding the following method in your User class:, (*10)

protected static function sendNotification()
{
    static::created(function ($user) {
        $user->notify(new MyOwnNotificationClass($user));
    });
}

To alter the notification template itself, follow the steps outlined in the Laravel documentation: https://laravel.com/docs/5.3/notifications#customizing-the-templates., (*11)

The Versions

26/07 2018

dev-master

9999999-dev

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC

01/11 2016

0.1.5

0.1.5.0

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC

12/10 2016

0.1.4

0.1.4.0

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC

27/09 2016

0.1.3

0.1.3.0

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC

26/09 2016

dev-develop

dev-develop

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC

26/09 2016

0.1.2

0.1.2.0

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC

12/09 2016

0.1.1

0.1.1.0

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC

12/09 2016

0.1.0

0.1.0.0

User account activation via email confirmation for Laravel.

  Sources   Download

MIT

The Requires

 

The Development Requires

by GeneaLabs, LLC