src/Defender/Commands/MakePermission.php
protected function attachPermissionToUser($permission, $userId)
    {
        // Check if user exists
        if ($user = $this->userRepository->findById($userId)) {
            $user->attachPermission($permission);
            $this->info('Permission attached successfully to user');
        } else {
            $this->error('Not possible to attach permission. User not found');
        }
    }
protected function attachPermissionToUser($permission, $userId)
    {
        // Check if user exists
        if ($user = $this->userRepository->findById($userId)) {
            $user->attachPermission($permission);
            $this->info('Permission attached successfully to user');
        } else {
            $this->error('Not possible to attach permission. User not found');
        }
    }
protected function attachPermissionToUser ( $ permission , $ userId ) { // Check if user exists if ( $ user = $ this -> userRepository -> findById ( $ userId ) ) { $ user -> attachPermission ( $ permission ) ; $ this -> info ( 'Permission attached successfully to user' ) ; } else { $ this -> error ( 'Not possible to attach permission. User not found' ) ; } }
Attach Permission to user.

@param \Artesaos\Defender\Permission $permission
@param int                           $userId
Attach Permission to user .