/var/www/vhosts/nabawater/vendor/dektrium/yii2-user/commands
NameSizeModeActions
ConfirmController.php16210644editdlrm
CreateController.php18000644editdlrm
DeleteController.php17130644editdlrm
PasswordController.php16770644editdlrm
Edit: /var/www/vhosts/nabawater/vendor/dektrium/yii2-user/commands/DeleteController.php (1713B)
* * For the full copyright and license information, please view the LICENSE.md * file that was distributed with this source code. */ namespace dektrium\user\commands; use dektrium\user\Finder; use Yii; use yii\console\Controller; use yii\helpers\Console; /** * Deletes a user. * * @property \dektrium\user\Module $module * * @author Dmitry Erofeev */ class DeleteController extends Controller { /** @var Finder */ protected $finder; /** * @param string $id * @param \yii\base\Module $module * @param Finder $finder * @param array $config */ public function __construct($id, $module, Finder $finder, $config = []) { $this->finder = $finder; parent::__construct($id, $module, $config); } /** * Deletes a user. * * @param string $search Email or username */ public function actionIndex($search) { if ($this->confirm(Yii::t('user', 'Are you sure? Deleted user can not be restored'))) { $user = $this->finder->findUserByUsernameOrEmail($search); if ($user === null) { $this->stdout(Yii::t('user', 'User is not found') . "\n", Console::FG_RED); } else { if ($user->delete()) { $this->stdout(Yii::t('user', 'User has been deleted') . "\n", Console::FG_GREEN); } else { $this->stdout(Yii::t('user', 'Error occurred while deleting user') . "\n", Console::FG_RED); } } } } }