vendor/topthink/think-orm/src/model/Collection.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: zhangyajun <448901948@qq.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);

namespace think\model;

use think\Collection as BaseCollection;
use think\Model;
use think\Paginator;

/**
 * 模型数据集类
 */
class Collection extends BaseCollection
{
    /**
     * 延迟预载入关联查询
     * @access public
     * @param  array|string $relation 关联
     * @param  mixed        $cache    关联缓存
     * @return $this
     */
    public function load($relation, $cache = false)
    {
        if (!$this->isEmpty()) {
            $item = current($this->items);
            $item->eagerlyResultSet($this->items, (array) $relation, [], false, $cache);
        }

        return $this;
    }

    /**
     * 删除数据集的数据
     * @access public
     * @return bool
     */
    public function delete(): bool
    {
        $this->each(function (Model $model) {
            $model->delete();
        });

        return true;
    }

    /**
     * 更新数据
     * @access public
     * @param array $data       数据数组
     * @param array $allowField 允许字段
     * @return bool

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。