Jump24 - Laravel Developers that Click into Place. Never outsourced. Never offshored. Always exceptional.

Laravel Impersonate Ui

hapidjus/laravel-impersonate-ui image

Laravel Impersonate Ui stats

Downloads
766
Stars
38
Open Issues
3
Forks
5

View on GitHub →

UI for 404labfr/laravel-impersonate

Laravel Impersonate UI

Laravel Impersonate UI is a Laravel Package that adds an easy to use UI for selecting users to impersonate when using https://github.com/404labfr/laravel-impersonate

Requirements

  • Laravel >= 6.1
  • PHP >= 7.1

Installation

  • Require laravel-impersonate-ui with Composer
composer require hapidjus/laravel-impersonate-ui
  • Add the Trait Lab404\Impersonate\Models\Impersonate to your User model.
<?php
 
namespace App;
 
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Lab404\Impersonate\Models\Impersonate;
 
class User extends Authenticatable
{
use Notifiable,
Impersonate;
 
}

Configuration

To publish the config and blade files use:

php artisan vendor:publish --provider="Hapidjus\ImpersonateUI\ImpersonateUiServiceProvider"

Append --tag=config or --tag=view to only publish config or blade files.

This is the contents of the config file:

return [
 
/**
* Enable Laravel Impersonate UI
*
* Laravel Impersonate UI is enabled by default when in debug
*
*/
'enabled' => env('APP_DEBUG',false),
 
/**
* Users allowed to impersonate
*
* Array of user emails, i.e ['admin@example.com'] or null for all
*
*/
'users_allowed_to_impersonate' => ['admin@example.com'],
 
/**
* Position of icon.
*
* Supported: "bottom-right", "bottom-left", "top-left", "top-right"
*
*/
'icon_position' => 'bottom-right',
 
/**
* Show Impersonate button.
*
* Trying to save some clicks?
* Then this is the option for you! Select a user and BOOM -
* form submitted - user impersonated. No need to click any
* pesky buttons.
*
*/
'show_button' => true,
 
/**
* Globally include laravel-impersonate-ui.
*
* Or use this view: @include('impersonate-ui::impersonate-ui')
* Note: If you choose to include the partials view you need to add
* a check to test if the current users is allowed
* to impersonate
*/
'global_include' => true,
 
/**
* The URI/Route to redirect after taking an impersonation.
*
* Use 'back' to redirect to the previous page
*
*/
'take_redirect_to' => 'back',
 
/**
* The URI/Route to redirect after leaving an impersonation.
*
* Use 'back' to redirect to the previous page
*
*/
'leave_redirect_to' => 'back',
 
/**
* Only allow these users to be impersonated
*
* Array of user IDs or null for all
*
*/
'users_only' => null,
 
/**
* Exlude these users from beeing impersonated
*
* Array of user IDs or null for none
*
*/
'users_exclude' => null,
 
];

Partials view:

You can use the partials view to include the Impersonate UI on any pages you want. Note: If you choose to include the partials view you need to add a check to test if the current users is allowed to impersonate

@include('impersonate-ui::impersonate-ui')

Have fun impersonating.

Do not use in production!

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Hapidjus Laravel Impersonate Ui Related Articles

Laravel Web Push Notifications image

Laravel Web Push Notifications

Read article
Polyscope for Windows is Now Available image

Polyscope for Windows is Now Available

Read article
Drop in comments for Filament with Commentions image

Drop in comments for Filament with Commentions

Read article
Pretty PHP Info: A Modern Replacement for `phpinfo()` image

Pretty PHP Info: A Modern Replacement for `phpinfo()`

Read article
ArtisanFlow: A Flowchart Engine for Laravel and Alpine.js image

ArtisanFlow: A Flowchart Engine for Laravel and Alpine.js

Read article
JSON Alexander Gives Developers a Simpler, More Trustworthy Way to View JSON in the Browser image

JSON Alexander Gives Developers a Simpler, More Trustworthy Way to View JSON in the Browser

Read article
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
The Certification of Competence for Laravel logo

The Certification of Competence for Laravel

A community-driven, proctored assessment across 4 levels designed to validate real-world Laravel knowledge, from Junior to mastery-level Artisan. Official Vue.js, Official Nuxt, Angular, React, JS certifications also available.

The Certification of Competence for Laravel