| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class ImpersonateController extends Controller |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var AuthManager |
||
| 12 | */ |
||
| 13 | protected $authManager; |
||
| 14 | |||
| 15 | public function __construct(AuthManager $authManager) |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param int $id |
||
| 24 | * @param UserRepository $users |
||
| 25 | * @return \Illuminate\Http\RedirectResponse |
||
| 26 | */ |
||
| 27 | public function impersonate($id, UserRepository $users) |
||
| 28 | { |
||
| 29 | if ($this->authManager->guard('twill_users')->user()->can('impersonate')) { |
||
| 30 | $user = $users->getById($id); |
||
| 31 | $this->authManager->guard('twill_users')->user()->setImpersonating($user->id); |
||
|
|
|||
| 32 | } |
||
| 33 | |||
| 34 | return back(); |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return \Illuminate\Http\RedirectResponse |
||
| 39 | */ |
||
| 40 | public function stopImpersonate() |
||
| 44 | } |
||
| 45 | } |
||
| 46 |