mirror of
				https://github.com/elyby/accounts.git
				synced 2025-05-31 14:11:46 +05:30 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			514 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			514 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace api\models\authentication;
 | |
| 
 | |
| use api\aop\annotations\CollectModelMetrics;
 | |
| use api\models\base\ApiForm;
 | |
| use Yii;
 | |
| 
 | |
| class LogoutForm extends ApiForm {
 | |
| 
 | |
|     /**
 | |
|      * @CollectModelMetrics(prefix="authentication.logout")
 | |
|      * @return bool
 | |
|      */
 | |
|     public function logout(): bool {
 | |
|         $component = Yii::$app->user;
 | |
|         $session = $component->getActiveSession();
 | |
|         if ($session === null) {
 | |
|             return true;
 | |
|         }
 | |
| 
 | |
|         $session->delete();
 | |
| 
 | |
|         return true;
 | |
|     }
 | |
| 
 | |
| }
 |