PHP code example of pentangle / laravel-backpack-impersonation-addon
1. Go to this page and download the library: Download pentangle/laravel-backpack-impersonation-addon 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/ */
pentangle / laravel-backpack-impersonation-addon example snippets
`
/**
* @return bool
*/
public function canImpersonate()
{
return true;
}
/**
* @return bool
*/
public function canBeImpersonated()
{
return true;
}
public function impersonateButton($crud = false)
{
return '<a href="'.route("impersonate", $this->id).'">Impersonate this user</a>';
}
`
$this->crud->addButton('line', 'impersonateButton', 'model_function', 'impersonateButton');
`
php artisan vendor:publish --tag=impersonate