PHP code example of rhmdnj / laravel-impersonate

1. Go to this page and download the library: Download rhmdnj/laravel-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/ */

    

rhmdnj / laravel-impersonate example snippets




namespace App\Models;

use Octopy\LaraPersonate\Models\Impersonate;
use Illuminate\Foundation\Auth\User as Authenticatable;

/**
 * Class User
 * @package App\Models
 */
class User extends Authenticatable
{
    use Impersonate;
}

/**
* @return bool
*/
public function canImpersonate() : bool
{
    // example
    return $this->is_admin === 1;
}

/**
* @return bool
*/
public function canBeImpersonated() : bool
{
    // example
    return $this->can_be_impersonated === 1;
}