1. Go to this page and download the library: Download laravolt/auth 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/ */
laravolt / auth example snippets
return [
// Base layout to extend by every view
'layout' => 'ui::layouts.auth',
// Enable captcha (Google reCaptcha) on login form
'captcha' => false,
// Column name to be checked for authentication (login)
'identifier' => 'email',
// Configuration related to login process
'login' => [
'implementation' => \Laravolt\Auth\DefaultLogin::class,
],
// Configuration related to registration process
'registration' => [
// Enable or disable registration form
'enable' => true,
// Default status for newly registered user
'status' => 'ACTIVE',
// During the process, data from registration form will be passed to this class.
// You may create your own implementation by creating UserRegistrar class.
'implementation' => \Laravolt\Auth\DefaultUserRegistrar::class,
],
// Configuration related to registration process
'activation' => [
// If enabled, newly registered user are not allowed to login until they click
// activation link that sent to their email.
'enable' => false,
// Status for newly registered user, before activation
'status_before' => 'PENDING',
// Status for newly registered user, after successfully activate their account
'status_after' => 'ACTIVE',
],
// Routes configuration
'router' => [
'middleware' => ['web'],
'prefix' => 'auth',
],
// Redirect configuration
'redirect' => [
// Where to redirect after successfully login
'after_login' => '/',
// Where to redirect after successfully register
'after_register' => '/',
// Where to redirect after successfully reset password
'after_reset_password' => '/',
],
// Whether to auto load migrations or not.
// If set to false, then you must publish the migration files first before running the migrate command
'migrations' => false,
];
namespace App\Registration;
use Illuminate\Support\Facades\Validator;
use Laravolt\Auth\Contracts\UserRegistrar;
class CustomUserRegistrar implements UserRegistrar
{
/**
* Validate data.
*
* @param array $data
*/
public function validate(array $data)
{
// Modify default behaviour, or completely change it
return Validator::make(
$data,
[
'name' => '
...
class CustomUserRegistrar implements UserRegistrar, ShouldActivate
{
...
/**
* Notify if user to activate the user with the token provided.
*
* @param \Illuminate\Database\Eloquent\Model|Authenticatable $user
* @param string $token
* @return void
*/
public function notify(Model $user, $token)
{
//
}
/**
* Activation method by the token provided.
*
* @param string $token
* @return \Illuminate\Http\Response
*/
public function activate($token)
{
$token = \DB::table('users_activation')->whereToken($token)->first();
if (! $token) {
abort(404);
}
\User::where('id', $token->user_id)->update(['status' => config('laravolt.auth.activation.status_after')]);
\DB::table('users_activation')->where('user_id', $token->user_id)->delete();
return redirect()->route('auth::login')->withSuccess(trans('auth::auth.activation_success'));
}
}
...
'registration' => [
// During the process, data from registration form will be passed to this class.
// You may create your own implementation by creating UserRegistrar class.
'implementation' => \App\Registration\CustomUserRegistrar::class,
],
...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.