Save search term to

@return mixed
326160
public function search()
    {
        if (request()->get('query') == "") {
            return $this->reset();
        }
        
        session()->put($this->getSearchableKey(), request()->get('query'));

        if (request()->redirectUri) {
            return redirect()->to(request()->redirectUri);
        }

        return redirect()->to($this->previousUrl());
    }
992098
public function save()
	{
		$data = $this->get('details');

		if ($data instanceof Registry)
		{
			$this->set('details', $data->toString());
		}
		else if (!is_string($data))
		{
			$this->set('details', json_encode($data));
		}

		$isNew = $this->isNew();
		$result = parent::save();

		if ($result)
		{
			Event::trigger('activity.onLogSave', [$this, $isNew]);
		}

		return $result;
	}
883558
public function save()
    {
        $di = DI::getDefault();

        $database = $di->getService( "database" );

        /**
         * Decide if we should update or insert
         * (if we know the record exists in the database...)
         */
        if ( $this->_exists_in_db )
        {
            /**
             * Retrieve a query from the query builder
             */
            $query = $database->buildQuery( $this->_table_name, "update", array("columns" => $this->_columns) );
            
            /**
             * Create an array with the model attributes (binding parameters)
             */
            $attributes = $this->getAttributes();
            
            /**
             * Add "snap_" prefix to the snapshot in order to not get index conflict when we merge attributes and snapshot
             */
            $snapshot = array();
            
            foreach ( $this->_snapshot as $key => $value )
            {
                $snapshot["snap_" . $key] = $value;
            }
            
            /**
             * Merge our binding parameters.
             * Bind the parameters to the query and return the result.
             */
            return $query->execute( array_merge($attributes, $snapshot) );
        }
        else
        {
            /**
             * Retrieve a query from the query builder
             */
            $query = $database->buildQuery( $this->_table_name, "insert", array("columns" => $this->_columns) );
            
            /**
             * Create an array with the model attributes (binding parameters)
             */
            $attributes = $this->getAttributes();
            
            /**
             * Bind the parameters and return the result
             */
            return $query->execute( $attributes );
        }
    }
661880
public function saveItemAction()
    {
        $success = 0;
        $message = 'tr_melis_cms_prospects_theme_items_save_failed';
        $errors  = [];
        $title   = 'tr_melis_cms_prospects_theme_items';
        $request = $this->getRequest();
        $itemId  = null;
        $inputValidator = 0;
        
        if ($request->isPost()) {

            $forms = $this->tool()->sanitizeRecursive(get_object_vars($request->getPost()), ["'",'"'], false);
            $themeId = $forms['themeId'];
            
            if (isset($forms['forms']) && !empty($forms['forms'])) {

                foreach ($forms['forms'] as $idx => $form) {
                    //check for existing item id
                    $itemId =  empty($itemId) ? (int) $form['item_trans_theme_item_id'] : $itemId;
                    $itemTexts =  empty($itemTexts) ? $form['item_trans_text'] : $itemTexts;

                    //check if is there an input
                    if(!empty($form['item_trans_text']) || $form['item_trans_text']!="")
                        $inputValidator++;

                }
                if($inputValidator) {

                    // create if item ID is empty
                    if(empty($itemId) && !empty($itemTexts)) {
                        $itemId =  $this->themeItemTable()->save(array('pros_theme_id' => $themeId));
                    }

                    foreach ($forms['forms'] as $idx => $form) {

                        $transId = isset($form['item_trans_id']) ? (int) $form['item_trans_id'] : null;
                        $text = $form['item_trans_text'];

                        if(!empty($transId) && empty($text)) {
                            // delete the entry if it is blank
                            $this->themeItemTransTable()->deleteById($transId);
                        }

                        if(!empty($itemId) && !empty($text)){

                            $form['item_trans_theme_item_id'] = $itemId;
                            unset($form['item_trans_id']);
                            $this->themeItemTransTable()->save($form, $transId);

                        }

                    }

                    $success = 1;
                    $message = 'tr_melis_cms_prospects_theme_items_save_success';
                }else {
                    $success = 0;
                    $errors[$this->tool()->getTranslation("tr_melis_cms_prospects_theme_items_pros_theme_item_text2")]["isEmpty"] = $this->tool()->getTranslation("tr_melis_cms_prospects_theme_items_trans_text_empty");
                }
            }

        }

        $response = [
            'success' => $success,
            'errors' => $errors,
            'textMessage' => $this->tool()->getTranslation($message),
            'textTitle' => $this->tool()->getTranslation($title)
        ];

        $this->getEventManager()->trigger('meliscmsprospects_theme_item_save_end', $this, array_merge($response, array('typeCode' => 'CMS_PROSPECTS_THEME_ITEM_SAVE', 'itemId' => $itemId)));

        return new JsonModel($response);
    }
682386
public function makeSearch($term)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('User', 'read')) {
            return $this->noPermission();
        }

        $orderBy = (isset($_GET['order'])) ? $orderBy = $_GET['order'] : 'userID';
        $orderType = (isset($_GET['type'])) ? $orderType = $_GET['type'] : 'DESC';

        // join parameters for the query
        // we are left joinin the the media table
        $joins = array(
          [
            'table' => 'media',
            'type' => 'left',
            'whereTable1' => "profileImageID",
            'whereTable2' => "mediaID",
          ]
        );

        $excludeColumns = array('remember_token', 'created_at', 'updated_at');
        return Search::searchByTerm('users', $term, 1, true, array(), $excludeColumns, $orderBy, $orderType, $joins);
    }
803195
def save(self):
        """"""
        self.write(self.term.save)
        self._saved = True
1373478
public function actionAdvancedSearch()
    {
        $dataProvider = null;
        $list = [];

        $model = new SearchForm;
        $model->setParams();

        if ($model->nextPage) {
            $dataProvider = $model->searchAdvanced();
        } else {
            $categories = Category::find()->orderBy(['name' => SORT_ASC]);
            $forums = Forum::find()->orderBy(['name' => SORT_ASC]);

            foreach ($categories->each() as $cat) {
                $catlist = [];
                foreach ($forums->each() as $for) {
                    if ($for->category_id == $cat->id) {
                        $catlist[$for->id] = '|-- ' . Html::encode($for->name);
                    }
                }
                $list[Html::encode($cat->name)] = $catlist;
            }

            if ($model->load(Yii::$app->request->post()) && $model->validate()) {
                if (empty($model->query) && empty($model->author)) {
                    $this->error(Yii::t('podium/flash', "You have to enter words or author's name first."));
                } else {
                    $stop = false;
                    if (!empty($model->query)) {
                        $words = explode(' ', preg_replace('/\s+/', ' ', $model->query));
                        $checkedWords = [];
                        foreach ($words as $word) {
                            if (mb_strlen($word, 'UTF-8') > 2) {
                                $checkedWords[] = $word;
                            }
                        }
                        $model->query = implode(' ', $checkedWords);
                        if (mb_strlen($model->query, 'UTF-8') < 3) {
                            $this->error(Yii::t('podium/flash', 'You have to enter word at least 3 characters long.'));
                            $stop = true;
                        }
                    }
                    if (!$stop) {
                        $dataProvider = $model->searchAdvanced();
                    }
                }
            }
        }

        return $this->render('search', [
            'model' => $model,
            'list' => $list,
            'dataProvider' => $dataProvider,
            'query' => $model->query,
            'author' => $model->author,
        ]);
    }
1160072
private function getSavedSearchWidgets(): array
    {
        $table = TableRegistry::get('Search.SavedSearches');

        $query = $table->find('all')
            ->where([
                'SavedSearches.name IS NOT' => null,
                'SavedSearches.name !=' => '',
                'SavedSearches.system' => false
            ])
            ->enableHydration(false)
            ->indexBy('id');

        if ($query->isEmpty()) {
            return [];
        }

        return [
            ['type' => 'saved_search', 'data' => $query->toArray()]
        ];
    }
706645
public function save()
    {
        $memoryTableAnnotation = ModelManager::getAnnotation($this, MemoryTable::class);
        if(null === $memoryTableAnnotation)
        {
            return null;
        }
        $data = [];
        foreach($this->__fieldNames as $fieldName)
        {
            $data[$fieldName] = $this[$fieldName];
        }
        MemoryTableManager::set($memoryTableAnnotation->name, $this->__key, $data);
    }
1011833
public function save()
    {
        $blSaved = parent::save();
        if ($blSaved && $this->oxcontents__oxloadid->value === 'oxagb') {
            $sShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
            $sVersion = $this->oxcontents__oxtermversion->value;

            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            // dropping expired..
            $oDb->execute("delete from oxacceptedterms where oxshopid='{$sShopId}' and oxtermversion != " . $oDb->quote($sVersion));
        }

        return $blSaved;
    }
801079
public function save()
    {
        $entries = $this->logBuffer->getEntries();

        $entrySkeleton = [
            'ts'    => $this->ts,
            'month' => $this->month,
            'year'  => $this->year
        ];

        $dimensionSkeleton = [
            'ts'    => $this->ts,
            'month' => $this->month,
            'year'  => $this->year
        ];

        /**
         * @var $e LogEntry
         */
        foreach ($entries as $e) {
            // build entry
            $entry = $entrySkeleton;
            $entry['entity'] = $e->getName();
            $entry['ref'] = $e->getRef();

            // check if we have attributes defined
            if (count($e->getAttributes()) > 0) {
                $entry['attributes'] = $e->getAttributes();
            }

            // insert or update the DAILY stat
            $this->mongo->update(self::ADB_STATS_DAILY, // match
                [
                    'entity' => $e->getName(),
                    'ref'    => $e->getRef(),
                    'ts'     => $this->ts
                ], // update
                [
                    '$inc'         => ['count' => $e->getIncrement()],
                    '$setOnInsert' => $entry
                ], // options
                ['upsert' => true]);

            // insert or update the MONTHLY stat
            unset($entry['ts']);
            $entry['month'] = $this->month;
            $entry['year'] = $this->year;
            $this->mongo->update(self::ADB_STATS_MONTHLY, // match
                [
                    'entity' => $e->getName(),
                    'ref'    => $e->getRef(),
                    'ts'     => $this->monthTs
                ], // update
                [
                    '$inc'         => ['count' => $e->getIncrement()],
                    '$setOnInsert' => $entry
                ], // options
                ['upsert' => true]);

            // insert dimensions for the entry
            $dimEntry = $dimensionSkeleton;
            $dimEntry['entity'] = $e->getName();

            /**
             * @var $dim LogDimension
             */
            foreach ($e->getDimensions() as $dim) {
                $dimEntry['name'] = $dim->getName();
                $dimEntry['value'] = $dim->getValue();

                $this->mongo->update(self::ADB_DIMS, // match
                    [
                        'name'   => $dim->getName(),
                        'value'  => $dim->getValue(),
                        'entity' => $e->getName(),
                        'ts'     => $this->ts
                    ], // update
                    [
                        '$inc'         => [
                            'count.' . $e->getRef() => $dim->getIncrement(),
                            'total'                 => $dim->getIncrement()
                        ],
                        '$setOnInsert' => $dimEntry
                    ], // options
                    ['upsert' => true]);
            }
        }

        // clear buffer
        $this->logBuffer = new LogBuffer();
    }
1300786
public function save()
	{
		$result = $this->getClient()->save();
		$prodIds = array_unique( $this->getView()->param( 'product/catalog.lists.refid', [] ) );

		if( !empty( $prodIds ) )
		{
			$context = $this->getContext();
			$manager = \Aimeos\MShop::create( $context, 'product' );
			$domains = ['attribute', 'price', 'product', 'supplier', 'text'];

			$search = $manager->createSearch( true )->setSlice( count( $prodIds ) );
			$search->setConditions( $search->compare( '==', 'product.id', $prodIds ) );

			$items = $manager->searchItems( $search, $domains );
			\Aimeos\MShop::create( $context, 'index' )->rebuildIndex( $items );
		}

		return $result;
	}
208215
public function save()
    {
        // saving/updating seo params
        if (($sOxid = $this->_getSaveObjectId())) {
            $aSeoData = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('aSeoData');
            $iShopId = \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId();
            $iLang = $this->getEditLang();

            // checkbox handling
            if (!isset($aSeoData['oxfixed'])) {
                $aSeoData['oxfixed'] = 0;
            }

            $sParams = $this->_getAdditionalParams($aSeoData);

            $oEncoder = $this->_getEncoder();
            // marking self and page links as expired
            $oEncoder->markAsExpired($sOxid, $iShopId, 1, $iLang, $sParams);

            // saving
            $oEncoder->addSeoEntry(
                $sOxid,
                $iShopId,
                $iLang,
                $this->_getStdUrl($sOxid),
                $aSeoData['oxseourl'],
                $this->_getSeoEntryType(),
                $aSeoData['oxfixed'],
                trim($aSeoData['oxkeywords']),
                trim($aSeoData['oxdescription']),
                $this->processParam($aSeoData['oxparams']),
                true,
                $this->_getAltSeoEntryId()
            );
        }
    }
571567
public function save()
    {
        $aModule = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("aModules");

        $aModules = [];
        if ($tmp = json_decode($aModule, true)) {
            foreach ($tmp as $key => $value) {
                $sanitizedKey = str_replace(self::BACKSLASH_REPLACEMENT, "\\", $key);
                $aModules[$sanitizedKey] = $value;
            }
            $oModuleInstaller = oxNew(\OxidEsales\Eshop\Core\Module\ModuleInstaller::class);
            $aModules = $oModuleInstaller->buildModuleChains($aModules);
        }

        \OxidEsales\Eshop\Core\Registry::getConfig()->saveShopConfVar("aarr", "aModules", $aModules);
    }
784830
public function save()
    {
        $keys = array_keys($this->langstrings);
        sort($keys);

        $maxlen       = 0;
        $langPrefixes = array();
        foreach ($keys as $key) {
            $tokens = explode('.', $key);
            if (preg_match('/tl_layout\.[a-z]+\.css\./', $key)) {
                $tokens = array($tokens[0], $tokens[1] . '.' . $tokens[2], $tokens[3]);
            }
            $langPrefix = '$GLOBALS[\'TL_LANG\']';
            foreach ($tokens as $token) {
                $langPrefix .= '[\'' . $token . '\']';
            }

            $langPrefixes[$key] = $langPrefix;

            if (strlen($langPrefix) > $maxlen) {
                $maxlen = strlen($langPrefix);
            }
        }

        $buffer = $this->getHead() . PHP_EOL . PHP_EOL;
        foreach ($keys as $key) {
            $prefix  = $langPrefixes[$key];
            $buffer .= sprintf(
                '%s = %s;' . PHP_EOL,
                $prefix . str_repeat(' ', ($maxlen - strlen($prefix))),
                var_export($this->getValue($key), true)
            );
        }
        $buffer  .= PHP_EOL;
        $resource = fopen($this->filename, 'wb');
        fputs($resource, $buffer);

        fclose($resource);
    }
917663
def save_or_update_saved_search(params)
      if params[:save_new_search].present? || params[:save_search].present?
        if params[:save_new_search].present?
          @saved_search = new_saved_search(params)
        elsif params[:save_search].present? && params[:saved_search].present?
          @saved_search = update_saved_search(params)
        elsif params[:save_search].present?
          @saved_search = new_saved_search(params)
        end

        if @saved_search.save
          flash[:notice] = t('ransack.saved_search.save.success')
        else
          flash[:error] = t('ransack.saved_search.save.error')
        end
      end
    end
133055
public function actionSave()
    {
        if(Yii::$app->request->isAjax)
        {
            $p = Yii::$app->request->post();
            // after find there are old values (see modules/OneFile::afterFind())
            $model = OneFile::findOne($p['file_id']);
            // so, change them for new defs (see modules/OneFile::beforeSave())
            $model->vars = json_decode($p['defs']);
            $model->save(false, ['defs']);
            
            echo $p['file_id'];
        }
    }