lucacri/spark-impersonate
最新稳定版本:0.0.4
Composer 安装命令:
composer require lucacri/spark-impersonate
包简介
A Laravel Nova field allows you to authenticate as your users with Spark.
README 文档
README
This field allows you to authenticate as your users via Spark.
Forked from the beautiful package KABBOUCHI/nova-impersonate.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require lucacri/spark-impersonate
Usage
Add SparkImpersonate::make($this) field in App\Nova\User.php
<?php namespace App\Nova; use Lucacri\SparkImpersonate\SparkImpersonate; ... class User extends Resource { ... public function fields(Request $request) { return [ ID::make()->sortable(), Gravatar::make(), Text::make('Name') ->sortable() ->rules('required', 'max:255'), Text::make('Email') ->sortable() ->rules('required', 'email', 'max:255') ->creationRules('unique:users,email') ->updateRules('unique:users,email,{{resourceId}}'), Password::make('Password') ->onlyOnForms() ->creationRules('required', 'string', 'min:6') ->updateRules('nullable', 'string', 'min:6'), SparkImpersonate::make($this), // <--- // or SparkImpersonate::make($this)->withMeta([ 'hideText' => false, ]), ]; } ... }
Advanced Usage
By default all users can impersonate an user.
You need to add the method canImpersonate() to your user model:
/** * @return bool */ public function canImpersonate() { // For example return $this->is_admin == 1; }
By default all users can be impersonated.
You need to add the method canBeImpersonated() to your user model to extend this behavior:
Please make sure to pass instance Model or Nova Resource SparkImpersonate::make($this) SparkImpersonate::make($this->resource)
/** * @return bool */ public function canBeImpersonated() { // For example return $this->can_be_impersonated == 1; }
Credits
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 18.72k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-10-02


