public function impersonate(User $user, Impersonator $impersonator)
    {
        /** @var  \Arcanedev\LaravelImpersonator\Contracts\Impersonatable  $user */
        if ( ! $impersonator->start(auth()->user(), $user)) {
            $this->notifyDanger(
                trans('auth::users.messages.impersonation-failed.message'),
                trans('auth::users.messages.impersonation-failed.title')
            );

            return redirect()->back();
        }

        return redirect()->to('/');
    }
public function impersonate(User $user, Impersonator $impersonator)
    {
        /** @var  \Arcanedev\LaravelImpersonator\Contracts\Impersonatable  $user */
        if ( ! $impersonator->start(auth()->user(), $user)) {
            $this->notifyDanger(
                trans('auth::users.messages.impersonation-failed.message'),
                trans('auth::users.messages.impersonation-failed.title')
            );

            return redirect()->back();
        }

        return redirect()->to('/');
    }
public function impersonate ( User $ user , Impersonator $ impersonator ) { /** @var  \Arcanedev\LaravelImpersonator\Contracts\Impersonatable  $user */ if ( ! $ impersonator -> start ( auth ( ) -> user ( ) , $ user ) ) { $ this -> notifyDanger ( trans ( 'auth::users.messages.impersonation-failed.message' ) , trans ( 'auth::users.messages.impersonation-failed.title' ) ) ; return redirect ( ) -> back ( ) ; } return redirect ( ) -> to ( '/' ) ; }
Impersonate a user.

@param  \Arcanesoft\Contracts\Auth\Models\User                 $user
@param  \Arcanedev\LaravelImpersonator\Contracts\Impersonator  $impersonator

@return \Illuminate\Http\RedirectResponse
Impersonate a user .