PHP code example of starfolksoftware / password-history

1. Go to this page and download the library: Download starfolksoftware/password-history 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/ */

    

starfolksoftware / password-history example snippets


[
    /*
    * When using the "HasPasswordHistory" trait from this package, we need to know which
    * Eloquent model should be used to retrieve your roles. Of course, it
    * is often just the "PasswordHistory" model but you may use whatever you like.
    *
    * The model you want to use as a PasswordHistory model needs to implement the
    * `StarfolkSoftware\PasswordHistory\Contracts\PasswordHistory` contract.
    */
    'password_history_class' => \StarfolkSoftware\PasswordHistory\PasswordHistory::class,

    /**
     * The table name for password histories.
     */
    'table_name' => 'password_histories',

    /**
     * The models password column name
     */
    'models_password_column_name' => 'password',

    /**
     * Password change can not be the same with any password in the last 
     * {{ password_history_check_length }} recent passwords
     */
    'password_history_check_length' => env('PASSWORD_HISTORY_CHECK_LENGTH', 5),

    /*
    * The user model that should be used. If null, the default user provider from your
    * Laravel authentication configuration will be used.
    */
    'user_model' => \Illuminate\Foundation\Auth\User::class,
]

use StarfolkSoftware\PasswordHistory\Rules\NotInRecentPasswordHistory;

validator(collect($model)->toArray(), [
    'password' => NotInRecentPasswordHistory::ofUser($model),
])->validate();
bash
php artisan vendor:publish --provider="StarfolkSoftware\PasswordHistory\PasswordHistoryServiceProvider" --tag="migrations"
php artisan migrate
bash
php artisan vendor:publish --provider="StarfolkSoftware\PasswordHistory\PasswordHistoryServiceProvider" --tag="config"