PHP code example of mjelamanov / laravel-auth-password

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

    

mjelamanov / laravel-auth-password example snippets


// in resources/lang/en/validation.php

'auth_password' => 'The :attribute is not valid',

// In your controller

use Illuminate\Http\Request;
use Mjelamanov\Laravel\AuthPassword\Rule\RuleFactoryInterface;

public function changeUserPassword(Request $request, RuleFactoryInterface $ruleFactory)
{
    $this->validate($request, [
        'current_password' => ['bail', '

$ruleFactory->createRule(); // default application's guard
$ruleFactory->createRule('web');
$ruleFactory->createRule('api');

// or custom guard
$ruleFactory->createRule('admin');

$ruleFactory->createRule('non-existen'); // Throws \InvalidArgumentException 

// In your controller

public function changeUserPassword(Request $request)
{
    $this->validate($request, [
        'current_password' => 'bail|ds are valid. Place your logic here.
}

'field' => 'auth_password', // default application's guard
'field' => 'auth_password:web',
'field' => 'auth_password:api',

// or custom guard
'field' => 'auth_password:admin',

'field' => 'auth_password:non_existen', // Throws \InvalidArgumentException