login() public method

Logs in a user using the provided mobile and password.
public login ( ) : boolean
return boolean whether the user is logged in successfully
 public function actionLogin()
 {
     $model = new LoginForm();
     $model->load(Yii::$app->request->post(), '');
     if ($model->login()) {
         return ['status' => 'success', 'data' => ['token' => $model->user->access_token]];
     } else {
         return ['status' => 'fail', 'data' => ['errors' => $model->getFirstErrors()]];
     }
 }