PHP code example of chrisidakwo / laravel-auth-identifiers
1. Go to this page and download the library: Download chrisidakwo/laravel-auth-identifiers 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/ */
chrisidakwo / laravel-auth-identifiers example snippets
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use ChrisIdakwo\Auth\CustomAuthUser;
class User extends Authenticatable {
use Notifiable, CustomAuthUser;
/**
* Get the name of the unique identifier for the user.
*
* You can list as many items as possible in the array, or just one item.
*
* @return array
*/
public function getAuthIdentifiersName(): array {
return ['email', 'username', 'phone_number', 'pin'];
}
}
use Illuminate\Support\Facades\Auth;
$data = ['identifier' => '[email protected]', 'password' => 'foobar'];
if (Auth::attempt($data)) {
// Continue with whatever you want to do
}
bash
php artisan vendor:publish --tag=custom-auth
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.