mirror of
https://github.com/elyby/accounts.git
synced 2024-12-02 11:41:05 +05:30
24 lines
399 B
PHP
24 lines
399 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace api\models\authentication;
|
|
|
|
use api\models\base\ApiForm;
|
|
use Yii;
|
|
|
|
class LogoutForm extends ApiForm {
|
|
|
|
public function logout(): bool {
|
|
$component = Yii::$app->user;
|
|
$session = $component->getActiveSession();
|
|
if ($session === null) {
|
|
return true;
|
|
}
|
|
|
|
$session->delete();
|
|
|
|
return true;
|
|
}
|
|
|
|
}
|