https://github.com/lee-to/laravel-livewire-phone-auth
https://github.com/lee-to/laravel-livewire-phone-auth
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lee-to/laravel-livewire-phone-auth
- Owner: lee-to
- License: mit
- Created: 2021-03-19T14:29:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-11T08:03:59.000Z (almost 2 years ago)
- Last Synced: 2025-02-01T15:11:30.891Z (4 months ago)
- Language: PHP
- Size: 23.4 KB
- Stars: 20
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# laravel-phone-auth
https://youtu.be/UaYx2VgXMEY
## Important
- Need laravel livewire package
- The default template uses tailwind classes (customize it if you want)## Install
- install livewire
- install doctrine/dbal
- composer require lee-to/laravel-phone-auth- php artisan vendor:publish --provider="Leeto\PhoneAuth\Providers\PhoneAuthServiceProvider"
- configure config/phone_auth.php
### Usage
### User Model
- Add PhoneVerification Trait to User Model
``` php
use PhoneVerification;
```- Add phone cast to User Model
``` php
protected $casts = [
'phone' => PhoneCast::class
];
```### Blade component
#### Auth/Phone verification form- Simple
``` html
@livewire('phone-verification')
```- Without form wrap
``` html
@livewire('phone-verification', ['formWrap' => false])
```- Register new or login if phone verified and exist
``` html
@livewire('phone-verification', ['loginAndRegister' => true])
```### Check phone confirmed
\Leeto\PhoneAuth\Models\ConfirmedPhone::confirmed($phone, $user_id = null);
#### Components properties (override config)
- stopEvents (bool) = turn off emitBefore, emitAfter
- customRedirectTo (bool|array) = redirect after success
- emptyCustomFields (bool) = disable custom fields
- customParams (array) = send custom properties to view``` html
```