In .env file add your credentials, for example:
DB_HOST=localhost DB_DATABASE=test_mail_activation DB_USERNAME=root DB_PASSWORD= MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=??? MAIL_PASSWORD=??? MAIL_ENCRYPTION=ssl
In config/mail.php add your mail and name:
'from' => ['address' => 'yourmail@123.com', 'name' => 'Your Name'],
In app/User.php file(MODEL) to $fillable array add two more columns to look like this:
protected $fillable = [ 'name', 'email', 'password', 'code', 'active' ];
These will install all necessary views into Resource folder. Run artisan command:
php artisan make:auth
Make shure to erase following line from app/Http/routes.php:
Route::auth();
Your routes.php file should look like this:
<?php Route::get('/', function () { return view('welcome'); }); Route::group(['middleware' => 'web'], function () { Route::get('/home', 'HomeController@index'); });
Require this package with composer using the following command:
composer require mp3063/mail-activation
In config/app.php file add to ServiceProvider array this line:
mp3063\MailActivation\MailActivationServiceProvider::class,
This will copy migration file in database/migrations, and activate.blade.php in resources/emails. Run:
php artisan vendor:publish
Run:
php artisan migrate
End:
If you done all this steps you should have all views and routes ready for mail-activation! Just start your server and enjoj! All functionality and routes made by Laravel are preserved!