lee-to/laravel-phone-auth
laravel-phone-auth
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
use PhoneVerification;
- Add phone cast to User Model
protected $casts = [
'phone' => PhoneCast::class
];
Blade component
Auth/Phone verification form
- Simple
@livewire('phone-verification')
- Without form wrap
@livewire('phone-verification', ['formWrap' => false])
- Register new or login if phone verified and exist
@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
<livewire:phone-verification
:stopEvents="true"
:customRedirectTo="'/'"
:emptyCustomFields="true"
:customParams="['btn' => 'Login', 'title' => 'Login']"
:formWrap="false"
:loginAndRegister="true"
/>
Related Packages
dasundev/livewire-dropzone
A Livewire Dropzone component for simple drag-and-drop file uploads.
133,473
231
dasundev/livewire-quill-text-editor
A powerful livewire rich text editor component built top of Quill.
48,596
38
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 0.5.1.6 | ^7.3| | MIT | |
| 0.5.1.5 | ^7.3 | MIT | |
| 0.5.1.4 | ^7.3 | MIT | |
| 0.5.1.3 | ^7.3 | MIT | |
| 0.5.1.2 | ^7.3 | MIT | |
| 0.5.1 | ^7.3 | MIT |