1. Go to this page and download the library: Download norbybaru/passwordless-auth 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/ */
norbybaru / passwordless-auth example snippets
namespace App\Models;
...
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use NorbyBaru\Passwordless\CanUsePasswordlessAuthenticatable;
use NorbyBaru\Passwordless\Traits\PasswordlessAuthenticatable;
class User extends Authenticatable implements CanUsePasswordlessAuthenticatable
{
...
use Notifiable;
use PasswordlessAuthenticatable;
...
}
use Illuminate\Support\Facades\Route;
Route::post('login', function (Request $request) {
$validated = $request->validate([
'email' => '
});
return [
'sent' => 'Login link sent to inbox.',
'throttled' => 'Login link was already sent. Please check your inbox or try again later.',
'invalid_token' => 'Invalid link supplied. Please request new one.',
'invalid_user' => 'Invalid user info supplied.',
'verified' => 'Login successful.',
];
public function sendAuthenticationMagicLink(string $token): void
{
// Replace with your notification class.
// eg. $this->notify(new SendMagicLinkNotification($token));
}
sh
php artisan vendor:publish --provider="NorbyBaru\Passwordless\PasswordlessServiceProvider" --tag="passwordless-config"
sh
php artisan vendor:publish --provider="NorbyBaru\Passwordless\PasswordlessServiceProvider" --tag="passwordless-migrations"
sh
php artisan migrate
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.