Download the PHP package hashmatwaziri/laravel-multi-auth-impersonate without Composer
On this page you can find all versions of the php package hashmatwaziri/laravel-multi-auth-impersonate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hashmatwaziri/laravel-multi-auth-impersonate
More information about hashmatwaziri/laravel-multi-auth-impersonate
Files in hashmatwaziri/laravel-multi-auth-impersonate
Package laravel-multi-auth-impersonate
Short Description laravel-multi-auth-impersonate
License MIT
Homepage https://github.com/HashmatWaziri/laravel-multi-auth-impersonate
Informations about the package laravel-multi-auth-impersonate
laravel-multi-auth-impersonate
Requirements
- Php > 7.3 or 8
Installation
You can install the package via composer:
You can publish the config file with:
This is the contents of the published config file:
Redirect URLs
take Redirect : when impersonating another user, you can add the method takeRedirectTo()
to your model which is being impersonated:
example:
leave Redirect : when an impersonator ( the one who impersonated or logged in as another user) is leaving the impersonation, you can add the method leaveRedirectTo()
to that model:
example:
Usage
Impersonate a user:
Leave impersonation:
Routes
In your routes file, under web middleware, you must call the multiAuthImpersonate
route macro with any route name you choose to be used for this package.
This package let user decides on which package URL these routes should be registered
Alternatively, you can execute this macro with your RouteServiceProvider
.
Defining impersonation authorization
By default all users can impersonate an user.
You need to add the method canImpersonate()
to your guard model:
example:
By default all users can be impersonated.
You need to add the method canBeImpersonated()
to your guard model to extend this behavior:
Using your own strategy
-
Getting the manager:
- Working with the manager:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- HashmatWaziri
- All Contributors
License
The MIT License (MIT). Please see License File for more information.