public function addTeam($team) { $teams = Utils::getWorkflows()->read('teams'); if ($teams === false) { $teams = []; } if (is_null(Utils::find($teams, ['team_id' => $team['team_id']]))) { $teams[] = ['team' => $team['team'], 'team_id' => $team['team_id']]; Utils::getWorkflows()->write($teams, 'teams'); } }
public function getImByUser(\AlfredSlack\Models\UserModel $user) { $userId = $user->getId(); // Get the IM id if a user $ims = $this->getIms(true); $im = Utils::find($ims, ['user' => $userId]); if (empty($im)) { $im = $this->openIm($user); } return ModelFactory::getModel($im, '\\AlfredSlack\\Models\\ImModel'); }