get default urls for Datatables

@param \Illuminate\Database\Eloquent\Model $model
@return array
423059
private function getDefaultUrls($model)
    {
        $slug = getModelSlug($model);
        return [
            'details'   => lmbRoute("api.{$slug}.detail", ['id' => $model->id]),
            'fast_edit' => lmbRoute("api.{$slug}.fastEdit", ['id' => $model->id]),
            'edit'      => lmbRoute("api.{$slug}.update", ['id' => $model->id]),
            'destroy'   => lmbRoute("api.{$slug}.destroy", ['id' => $model->id]),
            'show'      => lmbRoute("admin.{$slug}.show", ['id' => $model->id])
        ];
    }
625509
private function getNodeValues($model)
    {
        $attribute = "{$this->name}_uc_first";
        return [
            'id'        => $model->id,
            'parent'    => $model->parent_id,
            'name'      => $model->$attribute,
            'level'     => $model->depth,
            'type'      => $model->isLeaf() ? 'file' : 'folder'
        ];
    }
999948
private function generateCompleteUrl($model)
    {
        $row = self::find($model->parent_id);

        if ($row) {
            if (strlen($row->slug) > 1) {
                $this->url = $row->slug . (strlen($this->url) ? '/' . $this->url : '');
            }

            return $this->generateCompleteUrl($row);
        }

        return $row;
    }
615914
public function retrieve(Model $model, $source)
    {
        return [
            'from' => parent::retrieve($model, $this->getAttributeFrom()),
            'to'   => parent::retrieve($model, $this->getAttributeTo()),
        ];
    }
447621
public function getMetaTags($model)
    {

        $lang = Yii::$app->language;
        if (Yii::$app->id === 'app-backend') {
            $lang = Yii::$app->wavecms->editedLanguage;
        }

        return $this->andWhere([
            'model' => $model,
            'language' => $lang
        ]);

    }
1251511
public static function get(Model $model)
    {
        return Mention::where('model_type', get_class($model))
            ->where('model_id', $model->getKey())
            ->get();
    }
569186
private function getPermissionsByModel(string $model) : array
    {
        $table = TableRegistry::getTableLocator()->get('RolesCapabilities.Capabilities');
        Assert::isInstanceOf($table, CapabilitiesTable::class);

        $groups = $table->getUserGroups($this->user['id']);

        $query = TableRegistry::getTableLocator()->get('RolesCapabilities.Permissions')
            ->find('all')
            ->select('foreign_key')
            ->where([
                // WARNING: this might conflict with APP table's name matching a plugin's table name
                'model' => $model,
                'type IN ' => ['view'],
                'OR' => [
                    ['owner_foreign_key IN ' => array_keys($groups), 'owner_model' => 'Groups'],
                    ['owner_foreign_key' => $this->user['id'], 'owner_model' => 'Users']
                ]
            ])
            ->applyOptions(['accessCheck' => false]);

        $result = [];
        foreach ($query->all() as $permission) {
            $result[] = $permission->get('foreign_key');
        }

        return $result;
    }
449194
public function scaffoldViewColumns(Model $model)
    {
        $items = new Mutable();

        $attributes = \admin\helpers\eloquent_attributes($model);

        foreach ($attributes as $key => $value) {
            $items->push($key);
        }

        return $items->build(
            new GridDecorator($model)
        );
    }
1084617
protected function _generateFormFields($model)
    {
        $model = TableRegistry::get($model);
        $columns = ConnectionManager::get('default')->schemaCollection()->describe($model->table())->columns();

        $ignoredFields = [
            'created',
            'modified',
            'created_by',
            'modified_by',
            'password'
        ];

        $result = [];

        foreach ($columns as $column) {
            if (!in_array($column, $ignoredFields)) {
                $result[$column] = [];
            }
        }
        return $result;
    }
1211479
protected function parseLocalizedEras(CldrModel $model)
    {
        $data = [];
        foreach ($model->getRawArray('dates/calendars/calendar[@type="gregorian"]/eras') as $widthType => $eras) {
            foreach ($eras as $eraNodeString => $eraValue) {
                $eraName = $model->getAttributeValue($eraNodeString, 'type');

                $data[$widthType][$eraName] = $eraValue;
            }
        }

        return $data;
    }
929015
protected function saveColumns(Model $model)
    {
        /** @var \T4\Orm\Model $class */
        $class = get_class($model);
        $columns = $class::getColumns();
        $relations = $class::getRelations();
        $cols = [];
        $sets = [];
        $data = [];

        foreach ($columns as $column => $def) {
            if (isset($model->{$column}) && null === $model->{$column} && isset($def['default'])) {
                $sets[$column] = ':' . $column;
                $data[':'.$column] = $def['default'];
            } else {
                $cols[] = $column;
                $sets[$column] = ':' . $column;
                switch ($def['type']) {
                    case 'boolean':
                        $data[':' . $column] = (int)$model->{$column};
                        break;
                    default:
                        $data[':' . $column] = $model->{$column};
                        break;
                }
            }
        }

        foreach ($relations as $rel => $def) {
            switch ($def['type']) {
                case $class::BELONGS_TO:
                    $column = $class::getRelationLinkName($def);
                    if (!in_array($column, $cols)) {
                        // todo: test this!
                        //if (isset($model->{$column}) && !is_null($model->{$column})) {
                        if (isset($model->{$column})) {
                            $sets[$column] = ':' . $column;
                            $data[':'.$column] = $model->{$column};
                        } elseif (isset($model->{$rel}) && $model->{$rel} instanceof Model) {
                            $sets[$column] = ':' . $column;
                            $data[':'.$column] = $model->{$rel}->getPk();
                        }
                    }
                    break;
            }
        }

        $connection = $class::getDbConnection();
        if ($model->isNew()) {
            $query = new Query();
            $query->insert($class::getTableName())
                ->values($sets)
                ->params($data);
            $connection->execute($query);
            $model->{$class::PK} = $connection->lastInsertId();
        } else {
            $query = new Query();
            $query->update($class::getTableName())
                ->values($sets)
                ->where($this->quoteName($class::PK) . '='. $model->getPk())
                ->params($data);
            $connection->execute($query);
        }

        return $model;

    }
1043213
public function prepareCacheData(AbstractModel $model)
    {
        /**
         * @todo change MySQLTableData to a usecase based one
         */
        $tableData  = clone $this->tableData;
        $reflection = new \ReflectionClass($model);
        $tableData->setTableName($this->parseTableName($reflection));

        return [
            'tableData'    => $tableData,
            'reflection'   => new \ReflectionClass($model),
            'relationList' => $this->extractRelations($reflection),
        ];
    }
456219
public function getList(Model $model) {
        return $model->find('list', array(
            'order' => array($model->alias . '.' . $model->displayField => 'ASC'),
            'cache' => $model->alias . '::getList',
            'cacheExpires' => $this->getExpiration($model)
        ));
    }
848730
protected function migratePivotAttributes(Model $model)
    {
        $values = [];

        foreach ($model->getAttributes() as $key => $value) {
            // To get the pivots attributes we will just take any of the attributes which
            // begin with "pivot_" and add those to this arrays, as well as unsetting
            // them from the parent's models since they exist in a different table.
            if (strpos($key, 'pivot_') === 0) {
                $values[substr($key, 6)] = $value;

                $model->{$key} = null;
            }
        }

        return $values;
    }
1373715
public function getUrl($model = null)
    {
        if($model === null) {
            $m = $this->commentFor[$this->model];
            $model = $this->$m;
        }
        return $model ? $model->url . '#c' . $this->id : '';
    }
719215
protected function getModelInstanceQuery(Model $model)
    {
        $query = $model->query();

        $this->applyOrderingToModelInstanceQuery($query);
        $this->applyStartAndStopLimitsToQuery($query);

        return $query;
    }
1111196
protected function getModelPrimaryKeyString($model)
    {
        return is_array($model->getPrimaryKey()) ? implode('-', $model->getPrimaryKey()) : $model->getPrimaryKey();
    }