PHP code example of crow / laravel-activation-code
1. Go to this page and download the library: Download crow/laravel-activation-code library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
crow / laravel-activation-code example snippets
\Crow\LaravelActivationCode\Providers\ActivationCodeServiceProvider::class,
php artisan vendor:publish --provider="Crow\LaravelActivationCode\Providers\ActivationCodeServiceProvider" --tag=config
php artisan activation:code:publish --tag=migration
php artisan migrate
namespace App;
class CustomFile extends \Crow\LaravelActivationCode\Model\ActivationCode
{
// other code
}
$model = $service->getByCode('12345', 'user_register');
$model = $service->getByCode('12345', 'user_register', false);
// 1 parameter - code
// 2 parameter - type code (context) (user activation, password recovery, confirm order or other)
// 3 parameter - (optional) use exception (true - use (default), false - not use)
// generate code
$model = $service->make('[email protected] ', 'user_register');
// get code
$model = $service->get('[email protected] ', '12345', 'user_register');
... you PHP code
// activate of code
$service->delete($model);
// custom configuration
$service
->setMode(\Crow\LaravelActivationCode\ActivationCodeService::MODE_SMS)
->setGenerateCodeMode(\Crow\LaravelActivationCode\ActivationCodeService::GENERATE_CODE_MODE_ALPHABET_LOWER)
->setCodeLength(7)
->setCodeTTL('20m')
->setMaxAttempt(3);
// create code
$model = $service->make('[email protected] ', 'user_register');
// get code
$service->setMaxAttempt(3);
$model = $service->get('[email protected] ', '12345', 'user_register');
... you PHP code
// activate of code
$service->delete($model);