1. Go to this page and download the library: Download lucacri/spark-impersonate library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lucacri / spark-impersonate example snippets
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(' 'min:6')
->updateRules('nullable', 'string', 'min:6'),
SparkImpersonate::make($this), // <---
// or
SparkImpersonate::make($this)->withMeta([
'hideText' => false,
]),
];
}
...
}
/**
* @return bool
*/
public function canImpersonate()
{
// For example
return $this->is_admin == 1;
}
/**
* @return bool
*/
public function canBeImpersonated()
{
// For example
return $this->can_be_impersonated == 1;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.