src/base/Filter.php
public function findModel()
    {
        // find filter model based on the identifier
        $model = StorageFilter::find()->where(['identifier' => static::identifier()])->one();
        // if no model exists, create new record
        if (!$model) {
            $model = new StorageFilter();
            $model->setAttributes([
                'name' => $this->name(),
                'identifier' => static::identifier(),
            ]);
            $model->insert(false);
            $this->addLog("Added new filter '".static::identifier()."' with id '{$model->id}'.");
        }

        return $model;
    }
public function findModel()
    {
        // find filter model based on the identifier
        $model = StorageFilter::find()->where(['identifier' => static::identifier()])->one();
        // if no model exists, create new record
        if (!$model) {
            $model = new StorageFilter();
            $model->setAttributes([
                'name' => $this->name(),
                'identifier' => static::identifier(),
            ]);
            $model->insert(false);
            $this->addLog("Added new filter '".static::identifier()."' with id '{$model->id}'.");
        }

        return $model;
    }
public function findModel ( ) { // find filter model based on the identifier $ model = StorageFilter :: find ( ) -> where ( [ 'identifier' => static :: identifier ( ) ] ) -> one ( ) ; // if no model exists, create new record if ( ! $ model ) { $ model = new StorageFilter ( ) ; $ model -> setAttributes ( [ 'name' => $ this -> name ( ) , 'identifier' => static :: identifier ( ) , ] ) ; $ model -> insert ( false ) ; $ this -> addLog ( "Added new filter '" . static :: identifier ( ) . "' with id '{$model->id}'." ) ; } return $ model ; }
Find the model based on the identifier. If the identifier does not exists in the database, create
new record in the database.

@return object \luya\admin\models\StorageFilter
Find the model based on the identifier . If the identifier does not exists in the database create new record in the database .