nckg/laravel-impersonate
Impersonate
Introduction
Easily impersonate any user in your Laravel Application
Installation
You can install the package via composer:
composer require nckg/laravel-impersonate
Add following code to your user model:
class User
{
use \Nckg\Impersonate\Traits\CanImpersonate;
}
Add following code to your routes file:
Route::get('users/{id}/impersonate', function ($id) {
\Auth::user()->setImpersonating($id);
return redirect()->back();
});
Route::get('users/stop-impersonate', function () {
\Auth::user()->stopImpersonating();
return redirect()->back();
});
If you are using Laravel you can add the middleware to your middleware providers
// app/Http/Kernel.php
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware = [
...
\Nckg\Impersonate\Impersonate::class,
];
Testing
composer test
License
The MIT License (MIT).
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
634,760,849
9,707
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
408,553,772
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
387,976,821
4,658