1. Go to this page and download the library: Download axproo/auth-lib 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/ */
$data = [
[
'role_name' => 'superadmin',
'description' => 'Administrateur avec tous les super privilèges'
],
[
'role_name' => 'admin',
'description' => 'Administrateur avec tous les privilèges'
],
[
'role_name' => 'user',
'description' => 'Utilisateurs avec droits limités'
],
];
$builder = $this->db->table('rules');
foreach ($data as $row) {
$exists = $builder
->where('role_name', $row['role_name'])
->get()->getRow();
if (!$exists) {
$builder->insert($row);
}
}
$auth = new \Axproo\Auth\Services\AuthService();
$response = $auth->login();
print_r($response);
use Axproo\Auth\Helpers\FormBuilder;
$fields = ['email'];
$overrides = [];
$form = new FormBuilder('/generate');
print_r($form->build($fields, $overrides));
use Axproo\Auth\Helpers\FormBuilder;
// Définition des champs du formulaire
$fields = ['email', 'password']; // Exemple : ['email','password']
// Personnalisation du rendu ou des contraintes, par défaut les champs email et password sont s));