PHP code example of danhunsaker / laravel-topology
1. Go to this page and download the library: Download danhunsaker/laravel-topology 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/ */
danhunsaker / laravel-topology example snippets
'providers' => [
// ...
DanHunsaker\PasswordTopology\TopologyServiceProvider::class,
],
$v = Validator::make(
['password' => '12345QWERTqwert@'],
['password' => 'topology']
);
$v->passes();
$v = Validator::make(
['ssn' => '555-55-5555'],
['ssn' => 'topology:dddsddsdddd,ddddddddd']
);
$v->passes();
// Don't allow US phone numbers without area codes
$v = Validator::make(
['phone' => '555-555-5555'],
['phone' => 'topology:!ddddddd,!dddsdddd']
);
$v->passes();
$v = Validator::make(
['current' => 'QWERT12345qwert!', 'password' => '12345QWERTqwert@'],
['password' => 'topo-dist:current']
);
$v->passes();
use Illuminate\Foundation\Auth\ResetsPasswords;
use DanHunsaker\PasswordTopology\ResetsPasswords;
use DanHunsaker\PasswordTopology\TracksTopologyUsage;
class RegisterController extends Controller
{
use RegistersUsers, TracksTopologyUsage;
// ...
protected function create(array $data)
{
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
$this->updateTopologyUsage($data['password']);
return $user;
}
}
bash
php artisan vendor:publish --provider DanHunsaker\\PasswordTopology\\TopologyServiceProvider