mis3085 / laravel-admin-ext-forgot-password
Forgot password for Laravel-admin
0.0.2
2021-11-01 08:36 UTC
Requires
- php: ^7.3|^8.0
- encore/laravel-admin: ~1.6
- laravel/framework: ^8.0
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-11-29 06:41:28 UTC
README
Requirement
- "php": "^7.3|^8.0",
- "laravel/framework": "^8.0",
- "encore/laravel-admin": "~1.6"
Installation
composer require mis3085/laravel-admin-ext-forgot-password
User Model Modification
- Add
email
field toadmin_users
table and migrate. - Create a new model for
admin_users
- extends
Encore\Admin\Auth\Database\Administrator
- implements interface
Illuminate\Contracts\Auth\CanResetPassword
- use trait
Illuminate\Notifications\Notifiable
- use trait
Illuminate\Auth\Passwords\CanResetPassword
- ex:
namespace App\Models; use Encore\Admin\Auth\Database\Administrator; use Illuminate\Notifications\Notifiable; use Illuminate\Auth\Passwords\CanResetPassword; use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; class AdminUser extends Administrator implements CanResetPasswordContract { use CanResetPassword; use Notifiable; //... }
- extends
Config Modification
- Edit
config/admin.php
, changeauth.providers.admin.model
fromEncore\Admin\Auth\Database\Administrator::class
toApp\Models\AdminUser::class
, ex:'providers' => [ 'admin' => [ 'driver' => 'eloquent', 'model' => App\Models\AdminUser::class, ], ],
- Edit
config/auth.php
, add a new broker topasswords
'admin' => [ 'provider' => 'admin', 'table' => 'password_resets', 'expire' => 60, 'throttle' => 60, ],
View Modification
- Copy
./vendor/encore/laravel-admin/resources/views/login.blade.php
to./resources/views/vendor/admin/
(skip this process if you have already done it before) - Add this link to
./resources/views/vendor/admin/login.blade.php
<a class="btn btn-link" href="{{ route('admin.password.request') }}">{{ __('Forgot your password?') }}</a>