Create Model data for Request

@param Model $model

@return array
357056
public function createModelData(Model $model)
    {
        $data = [];

        if ($model->getId()) {
            $data['id'] = $model->getId();
        }
        if ($model->getName()) {
            $data['name'] = $model->getName();
        }
        if ($model->getConcepts()) {
            $data['output_info']['data'] = [];
            $data['output_info']['data'] = $this->addModelConcepts($data['output_info']['data'], $model->getConcepts());
        }
        $data['output_info']['output_config'] = $model->getOutputConfig();

        return $data;
    }
180693
protected function createTableModel(Model $model = null) {
		$phalconModel = new PhalconModel($this->getTableModelDi());
		$phalconModel->setDatagate($this);
		
		if ($model !== null) {
			$phalconModel->assign($model->getData());
		}
		
		return $phalconModel;
	}
286307
protected function getResponse($model)
    {
        $hiddenAttributes = array_filter(explode(',', Yii::$app->getRequest()->getQueryParam('hide', '')));
        $fields = FormBuilder::getFormFields($model, $this->getFields($model, 'form'), false, $hiddenAttributes);

        return [
            'model' => $model,
            'fields' => empty($fields) ? [] : [$fields],
            'relations' => $this->getModelRelations($model, $this->getExtraFields($model)),
        ];
    }
121912
protected function create(Request $request) : Model
  {
    return User::create([
      'name' => $request->input('name'),
      'email' => $request->input('email'),
      'password' => Hash::make($request->input('password'))
    ]);
  }
769457
protected function _getAliases(Model $Model) {
		$aliases = array_merge(array(
			//$Model->name,
			$Model->alias
				), $this->config[$Model->alias]['aliases']
		);

		foreach ($Model->associations() as $associationType) {
			foreach ($Model->$associationType as $associationKey => $association) {
				if ($association['className'] === $Model->name) {
					$aliases[] = $associationKey;
				}
			}
		}

		return $aliases;
	}
382064
private function addModelToArray($models, $model)
    {
        $apply_to_models = array();
        
        if (count($models) > 0) {
            foreach ($models as $item_json) {
                $item = json_decode($item_json);
                $object = $model->find($item->id);
                if ($object != null) {
                    for ($count = 1; $count <= $item->quantity; $count++) {
                        $apply_to_models[] = $object;
                    }
                }
            }
        }
        
        return $apply_to_models;
    }
291346
protected function scopedAttributes( $model )
	{
		$keys = $this->model->getScopedColumns();

		if ( count( $keys ) == 0 )
			return [];

		$values = array_map( function ( $column ) use ( $model )
		{
			return $model->getAttribute( $column );
		}, $keys );

		return array_combine( $keys, $values );
	}
157388
public function params($model = null)
    {
        $request = $this->_View->getRequest();

        if (empty($model)) {
            $model = $this->defaultModel();
        }
        if (!$request->getParam('paging') || !$request->getParam('paging.' . $model)) {
            return [];
        }

        return $request->getParam('paging.' . $model);
    }
53248
public static function with($model)
    {
        $data = static::model()->findAll();

        $idKey = null;
        $whereIn = [];
        foreach ($data as $key => $value) {
            $idKey = $value->primaryKey;
            $whereIn[] = $value->{$value->primaryKey};
        }

        $associatedModel = new $model();
        $associatedData = $associatedModel
            ->where(static::getForeignKey(static::model()->tableName), 'IN', implode(',', $whereIn))
            ->findAll();

        $data = static::buildRelations($data, $associatedModel, $associatedData);

        return $data;
    }
306243
public function model($model)
    {
        #$model = ucfirst($model).'Model';
        $modelPath = self::$instance->app->findModel($model);
        $modelClass = "App\\Model\\".$model;
        $this->model = new $modelClass();
        self::$instance->modelService = new ModelService();
        self::$instance->modelService->initialize(self::$instance->app);
        return $this->model;
        //$appModel->handleModel($controller, $method);
    }
261262
protected function newModelQuery($model = null)
    {
        return is_null($model)
                ? $this->createModel()->newQuery()
                : $model->newQuery();
    }
1180300
public function create($model, Request $request)
    {
        $settings = json_decode($request->controller_settings);
        $fields = json_decode($request->fields, true);

        //dd($request->all());

        $path = $this->getpath($this->name);

        if ($this->files->exists($path)) {
            throw new \Exception("Controller [$this->name] already exists!");
        }

        $stub = $this->files->get($this->getStub());

        $stub = $this->replace($stub, $this->name, $model)
                        ->replaceDisableds($stub, $settings)
                        ->replaceTimestamps($stub, $settings)
                        ->replaceGrid($stub, $fields)
                        ->replaceForm($stub, $fields)
                        ->replaceHeader($stub, $settings);

        //dd($settings, $stub);

        $this->createMenu($settings);

        $this->createRout($settings);

        $this->files->put($path, $stub);

        return $path;
    }
347539
protected static function encryptAttributes(Model $model)
    {
        foreach (static::getEncryptedAttributes() as $attribute) {
            try {
                $model->$attribute = static::getEncrypter()->encrypt($model->$attribute);
            } catch (EncryptException $e) {
            }
        }

        return $model;
    }
738319
private function create($model)
    {
        $attrs = $this->getMutableAttributes($model);
        $this->db
            ->connect()
            ->insert($this->table, array_keys($attrs))
            ->execute(array_values($attrs));
        $model->{$this->key} = $this->db->lastInsertId();
    }
1338617
public static function createFromModel(Model $model)
    {
        $table = $model->getTable();

        $dc = new static($table);

        $dc->strTable = $model->getTable();
        $dc->activeRecord = $model;
        $dc->intId = $model->id;

        return $dc;
    }
664757
protected function prepareModel(Model $model)
    {
        if (is_callable($this->prepareModel)) {
            call_user_func($this->prepareModel, $model);
        } else {
            foreach ($model->attributes() as $attribute) {
                $value = Yii::$app->settings->get($this->getSection($model), $attribute);

                if (!is_null($value)) {
                    $model->{$attribute} = $value;
                }
            }
        }
    }
978784
public function getData($model, $query = null)
    {
        $data = [];
        foreach ($model as $key => $value) {
            $data[$key] = $value;
        }
        return $data;
    }