承接 j84115/impersonate 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

j84115/impersonate

最新稳定版本:V0.1.0

Composer 安装命令:

composer require j84115/impersonate

包简介

...

README 文档

README

A simple Laravel Package to temporarily login as other users.

Usage

You can login to another user through {app_url}/impersonate/login/{user_id}.

And you can end the session with {app_url}/impersonate/logout.

Install Package

composer require j84115/impersonate Not yet on Packagist. Install manually.

Add Sevice Provider

Add the Package to config/app.php

J84115\Impersonate\ImpersonateServiceProvider::class,

Add Interface To User

Add the Interface to your User Model. Typically app/Models/User.php.

use J84115\Impersonate\Interfaces\ImpersonateUser;

Implement the interface.

class User extends Authenticatable implements ImpersonateUser

Then add your conditions for who can impersonate a user.

    public function impersonator(): bool
    {
        return $this->role === 'admin';
    }

    public function impersonatable(): bool
    {
        return $this->email !== 'admin';
    }

Routing

Add the following macro to your routes. Typically guarded with auth Middleware in routes/web.php.

Route::impersonate();

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-09-13