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