nicoaudy / impersonate
Laravel impersonate middleware, simply traits for impersonating other user
Requires
- illuminate/support: ~5|~6
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3|~4
- phpunit/phpunit: ^8.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2024-10-16 19:15:45 UTC
README
Simple package that do the trick, Impersonate makes it easy to authenticate as your users. Add a simple trait to your user model and impersonate as one of your users in one click.
Installation
Via Composer
$ composer require nicoaudy/impersonate
Add traits to your user model
// User.php use NicoAudy\Impersonate\Traits\Impersonate; class User extends Authenticatable { use Notifiable, Impersonate; // Other stuff }
Register Middleware to route
Route::middleware('impersonate')->group(function(){ // your routes can be impersonates });
Usage
Impersonate a user :
Auth::user()->setImpersonating($other_user_id);
Stop impersonating :
Auth::user()->stopImpersonating();
Check if current user impersonating :
Auth::user()->isImpersonating();
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.