PHP code example of tyler36 / confirmable-trait
1. Go to this page and download the library: Download tyler36/confirmable-trait 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/ */
tyler36 / confirmable-trait example snippets
php artisan vendor:publish --provider=Tyler36\ConfirmableTrait\ConfirmableServiceProvider
php artisan migrate
// App\Providers\EventServiceProvider.php
...
protected $listen = [
UserRequestedConfirmationEmail::class => [
SendConfirmationEmail::class
]
];
ConfirmUserController.php
// App\Http\Controllers\Auth\ConfirmUserController.php
...
public function edit()
{
return view('auth.confirmation');
}
App\Http\Kernel.php
// App\Http\Kernel.php
...
protected $routeMiddleware = [
...
'auth.confirmed' => \Tyler36\ConfirmableTrait\Middleware\isConfirmed::class,
]
App\Http\Kernel.php
// App\Http\Kernel.php
...
protected $routeMiddleware = [
...
'auth.notconfirmed' => \Tyler36\ConfirmableTrait\Middleware\isNotConfirmed::class,
]
$confirmation->validateToken($token)
// Confirmation.php
class Confirmation extends Model
{
...
protected $validForHours = 24;