框架更新
parent
6c215fcba7
commit
c3b584d5c0
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "af4c1d3fa817eb8c58caa9a7ec0362b0",
|
||||
"content-hash": "d9dceec7f610e50f6c7498e698d42d38",
|
||||
"packages": [
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
|
|
@ -18,7 +18,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
|
||||
"reference": "f3ad69181b8afed2c9edf7be5a2918144ff4ea32",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
|
|
@ -112,7 +118,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/d1925efb2207ac4be3ad0c40b8277175f99ffaff",
|
||||
"reference": "d1925efb2207ac4be3ad0c40b8277175f99ffaff",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"league/flysystem": "~1.0",
|
||||
|
|
@ -163,7 +175,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
|
||||
"reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
|
|
@ -219,7 +237,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
|
||||
"reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
|
|
@ -268,7 +292,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
|
||||
"reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.0"
|
||||
|
|
@ -316,7 +346,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
|
|
@ -366,7 +402,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
|
||||
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
|
|
@ -417,7 +459,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/framework/zipball/4789343672aef06d571d556da369c0e156609bce",
|
||||
"reference": "4789343672aef06d571d556da369c0e156609bce",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
|
|
@ -482,7 +530,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-helper/zipball/f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905",
|
||||
"reference": "f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.0"
|
||||
|
|
@ -525,7 +579,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-multi-app/zipball/ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
|
||||
"reference": "ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.0",
|
||||
|
|
@ -563,17 +623,23 @@
|
|||
},
|
||||
{
|
||||
"name": "topthink/think-orm",
|
||||
"version": "v2.0.40",
|
||||
"version": "v2.0.41",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/think-orm.git",
|
||||
"reference": "1119d979b850849f3725856460cf108eec1c3eb8"
|
||||
"reference": "64bbfdde01f4fd6939c2f695fceb08e6d764ac6b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/1119d979b850849f3725856460cf108eec1c3eb8",
|
||||
"reference": "1119d979b850849f3725856460cf108eec1c3eb8",
|
||||
"shasum": ""
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/64bbfdde01f4fd6939c2f695fceb08e6d764ac6b",
|
||||
"reference": "64bbfdde01f4fd6939c2f695fceb08e6d764ac6b",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
|
|
@ -612,9 +678,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/top-think/think-orm/issues",
|
||||
"source": "https://github.com/top-think/think-orm/tree/v2.0.40"
|
||||
"source": "https://github.com/top-think/think-orm/tree/v2.0.41"
|
||||
},
|
||||
"time": "2021-04-19T13:29:37+00:00"
|
||||
"time": "2021-07-14T07:51:15+00:00"
|
||||
},
|
||||
{
|
||||
"name": "topthink/think-template",
|
||||
|
|
@ -628,7 +694,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-template/zipball/abfc293f74f9ef5127b5c416310a01fe42e59368",
|
||||
"reference": "abfc293f74f9ef5127b5c416310a01fe42e59368",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.0",
|
||||
|
|
@ -669,7 +741,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-view/zipball/edce0ae2c9551ab65f9e94a222604b0dead3576d",
|
||||
"reference": "edce0ae2c9551ab65f9e94a222604b0dead3576d",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.0",
|
||||
|
|
@ -712,7 +790,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2df51500adbaebdc4c38dea4c89a2e131c45c8a1",
|
||||
"reference": "2df51500adbaebdc4c38dea4c89a2e131c45c8a1",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
|
|
@ -792,7 +876,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976",
|
||||
"reference": "9a142215a36a3888e30d0a9eeea9766764e96976",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
|
|
@ -868,7 +958,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/eca0bf41ed421bed1b57c4958bab16aa86b757d0",
|
||||
"reference": "eca0bf41ed421bed1b57c4958bab16aa86b757d0",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
|
|
@ -951,7 +1047,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/a586efdf2aa832d05b9249e9115d24f6a2691160",
|
||||
"reference": "a586efdf2aa832d05b9249e9115d24f6a2691160",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.3",
|
||||
|
|
@ -1040,7 +1142,13 @@
|
|||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-trace/zipball/9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
|
||||
"reference": "9a9fa8f767b6c66c5a133ad21ca1bc96ad329444",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1.0",
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ class Excel
|
|||
header('Expires: 0');
|
||||
header('Cache-Control:must-revalidate, post-check=0, pre-check=0');
|
||||
header('Content-Type:application/force-download');
|
||||
header('Content-Type: application/'.$this->file_type.';;charset='.$charset);
|
||||
header('Content-Type: application/'.$this->file_type.';charset='.$charset);
|
||||
header('Content-Type:application/octet-stream');
|
||||
header('Content-Type:application/download');
|
||||
header('Content-Disposition:attachment;filename='.$this->filename.'.'.$this->suffix);
|
||||
|
|
|
|||
|
|
@ -927,18 +927,24 @@
|
|||
},
|
||||
{
|
||||
"name": "topthink/think-orm",
|
||||
"version": "v2.0.40",
|
||||
"version_normalized": "2.0.40.0",
|
||||
"version": "v2.0.41",
|
||||
"version_normalized": "2.0.41.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/top-think/think-orm.git",
|
||||
"reference": "1119d979b850849f3725856460cf108eec1c3eb8"
|
||||
"reference": "64bbfdde01f4fd6939c2f695fceb08e6d764ac6b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/1119d979b850849f3725856460cf108eec1c3eb8",
|
||||
"reference": "1119d979b850849f3725856460cf108eec1c3eb8",
|
||||
"shasum": ""
|
||||
"url": "https://api.github.com/repos/top-think/think-orm/zipball/64bbfdde01f4fd6939c2f695fceb08e6d764ac6b",
|
||||
"reference": "64bbfdde01f4fd6939c2f695fceb08e6d764ac6b",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
|
|
@ -951,7 +957,7 @@
|
|||
"require-dev": {
|
||||
"phpunit/phpunit": "^7|^8|^9.5"
|
||||
},
|
||||
"time": "2021-04-19T13:29:37+00:00",
|
||||
"time": "2021-07-14T07:51:15+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
|
@ -979,7 +985,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/top-think/think-orm/issues",
|
||||
"source": "https://github.com/top-think/think-orm/tree/v2.0.40"
|
||||
"source": "https://github.com/top-think/think-orm/tree/v2.0.41"
|
||||
},
|
||||
"install-path": "../topthink/think-orm"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?php return array(
|
||||
'root' => array(
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => NULL,
|
||||
'name' => 'topthink/think',
|
||||
'reference' => '6c215fcba72e60dc4017bd65b0bc08b8b67c94d2',
|
||||
'name' => 'shopxo/shopxo',
|
||||
'dev' => true,
|
||||
),
|
||||
'versions' => array(
|
||||
|
|
@ -73,6 +73,15 @@
|
|||
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'shopxo/shopxo' => array(
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => '6c215fcba72e60dc4017bd65b0bc08b8b67c94d2',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-mbstring' => array(
|
||||
'pretty_version' => 'v1.23.0',
|
||||
'version' => '1.23.0.0',
|
||||
|
|
@ -118,15 +127,6 @@
|
|||
'reference' => '4789343672aef06d571d556da369c0e156609bce',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'topthink/think' => array(
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => NULL,
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'topthink/think-helper' => array(
|
||||
'pretty_version' => 'v3.1.5',
|
||||
'version' => '3.1.5.0',
|
||||
|
|
@ -146,12 +146,12 @@
|
|||
'dev_requirement' => false,
|
||||
),
|
||||
'topthink/think-orm' => array(
|
||||
'pretty_version' => 'v2.0.40',
|
||||
'version' => '2.0.40.0',
|
||||
'pretty_version' => 'v2.0.41',
|
||||
'version' => '2.0.41.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../topthink/think-orm',
|
||||
'aliases' => array(),
|
||||
'reference' => '1119d979b850849f3725856460cf108eec1c3eb8',
|
||||
'reference' => '64bbfdde01f4fd6939c2f695fceb08e6d764ac6b',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'topthink/think-template' => array(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
// This file is automatically generated at:2021-07-14 19:19:06
|
||||
// This file is automatically generated at:2021-07-19 11:36:48
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\app\\Service',
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ abstract class Paginator implements ArrayAccess, Countable, IteratorAggregate, J
|
|||
$path = $this->options['path'];
|
||||
} else {
|
||||
$parameters = [];
|
||||
$path = str_replace('[PAGE]', $page, $this->options['path']);
|
||||
$path = str_replace('[PAGE]', (string) $page, $this->options['path']);
|
||||
}
|
||||
|
||||
if (count($this->options['query']) > 0) {
|
||||
|
|
|
|||
|
|
@ -1075,7 +1075,7 @@ abstract class BaseQuery
|
|||
* 查找记录
|
||||
* @access public
|
||||
* @param mixed $data 数据
|
||||
* @return Collection
|
||||
* @return Collection|array|static[]
|
||||
* @throws Exception
|
||||
* @throws ModelNotFoundException
|
||||
* @throws DataNotFoundException
|
||||
|
|
@ -1109,7 +1109,7 @@ abstract class BaseQuery
|
|||
* 查找单条记录
|
||||
* @access public
|
||||
* @param mixed $data 查询数据
|
||||
* @return array|Model|null
|
||||
* @return array|Model|null|static
|
||||
* @throws Exception
|
||||
* @throws ModelNotFoundException
|
||||
* @throws DataNotFoundException
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ trait ResultOperation
|
|||
/**
|
||||
* 处理空数据
|
||||
* @access protected
|
||||
* @return array|Model|null
|
||||
* @return array|Model|null|static
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
* @throws DataNotFoundException
|
||||
|
|
@ -167,7 +167,7 @@ trait ResultOperation
|
|||
* 查找单条记录 不存在返回空数据(或者空模型)
|
||||
* @access public
|
||||
* @param mixed $data 数据
|
||||
* @return array|Model
|
||||
* @return array|Model|static
|
||||
*/
|
||||
public function findOrEmpty($data = null)
|
||||
{
|
||||
|
|
@ -226,7 +226,7 @@ trait ResultOperation
|
|||
* 查找多条记录 如果不存在则抛出异常
|
||||
* @access public
|
||||
* @param array|string|Query|Closure $data 数据
|
||||
* @return array|Model
|
||||
* @return array|Collection|static[]
|
||||
*/
|
||||
public function selectOrFail($data = null)
|
||||
{
|
||||
|
|
@ -237,7 +237,7 @@ trait ResultOperation
|
|||
* 查找单条记录 如果不存在则抛出异常
|
||||
* @access public
|
||||
* @param array|string|Query|Closure $data 数据
|
||||
* @return array|Model
|
||||
* @return array|Model|static
|
||||
*/
|
||||
public function findOrFail($data = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,6 +79,12 @@ abstract class Relation
|
|||
*/
|
||||
protected $withField;
|
||||
|
||||
/**
|
||||
* 排除关联数据字段
|
||||
* @var array
|
||||
*/
|
||||
protected $withoutField;
|
||||
|
||||
/**
|
||||
* 获取关联的所属模型
|
||||
* @access public
|
||||
|
|
@ -236,6 +242,18 @@ abstract class Relation
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排除关联数据的字段
|
||||
* @access public
|
||||
* @param array $field 关联字段限制
|
||||
* @return $this
|
||||
*/
|
||||
public function withoutField(array $field)
|
||||
{
|
||||
$this->withoutField = $field;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断闭包的参数类型
|
||||
* @access protected
|
||||
|
|
|
|||
|
|
@ -496,7 +496,9 @@ trait Attribute
|
|||
$value = $this->getJsonValue($fieldName, $value);
|
||||
} else {
|
||||
$closure = $this->withAttr[$fieldName];
|
||||
$value = $closure($value, $this->data);
|
||||
if ($closure instanceof \Closure) {
|
||||
$value = $closure($value, $this->data);
|
||||
}
|
||||
}
|
||||
} elseif (method_exists($this, $method)) {
|
||||
if ($relation) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ trait ModelEvent
|
|||
if (method_exists(static::class, $call)) {
|
||||
$result = call_user_func([static::class, $call], $this);
|
||||
} elseif (is_object(self::$event) && method_exists(self::$event, 'trigger')) {
|
||||
$result = self::$event->trigger(static::class . '.' . $event, $this);
|
||||
$result = self::$event->trigger('model.' . static::class . '.' . $event, $this);
|
||||
$result = empty($result) ? true : end($result);
|
||||
} else {
|
||||
$result = true;
|
||||
|
|
|
|||
|
|
@ -151,8 +151,16 @@ trait SoftDelete
|
|||
*/
|
||||
public static function destroy($data, bool $force = false): bool
|
||||
{
|
||||
// 包含软删除数据
|
||||
$query = (new static())->withTrashedData(true)->db(false);
|
||||
// 传入空值(包括空字符串和空数组)的时候不会做任何的数据删除操作,但传入0则是有效的
|
||||
if(empty($data) && $data !== 0){
|
||||
return false;
|
||||
}
|
||||
// 仅当强制删除时包含软删除数据
|
||||
$model = (new static());
|
||||
if($force){
|
||||
$model->withTrashedData(true);
|
||||
}
|
||||
$query = $model->db(false);
|
||||
|
||||
if (is_array($data) && key($data) !== 0) {
|
||||
$query->where($data);
|
||||
|
|
|
|||
|
|
@ -443,7 +443,12 @@ class BelongsToMany extends Relation
|
|||
if (empty($this->baseQuery)) {
|
||||
$tableName = $this->query->getTable();
|
||||
$table = $this->pivot->db()->getTable();
|
||||
$fields = $this->getQueryFields($tableName);
|
||||
|
||||
if ($this->withoutField) {
|
||||
$this->query->withoutField($this->withoutField);
|
||||
}
|
||||
|
||||
$fields = $this->getQueryFields($tableName);
|
||||
|
||||
if ($this->withLimit) {
|
||||
$this->query->limit($this->withLimit);
|
||||
|
|
|
|||
|
|
@ -206,6 +206,10 @@ class HasMany extends Relation
|
|||
$closure($this->getClosureType($closure));
|
||||
}
|
||||
|
||||
if ($this->withoutField) {
|
||||
$this->query->withoutField($this->withoutField);
|
||||
}
|
||||
|
||||
$list = $this->query
|
||||
->where($where)
|
||||
->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null)
|
||||
|
|
|
|||
|
|
@ -366,7 +366,12 @@ class HasManyThrough extends Relation
|
|||
$pk = $this->throughPk;
|
||||
$throughKey = $this->throughKey;
|
||||
$modelTable = $this->parent->getTable();
|
||||
$fields = $this->getQueryFields($alias);
|
||||
|
||||
if ($this->withoutField) {
|
||||
$this->query->withoutField($this->withoutField);
|
||||
}
|
||||
|
||||
$fields = $this->getQueryFields($alias);
|
||||
|
||||
$this->query
|
||||
->field($fields)
|
||||
|
|
|
|||
|
|
@ -200,7 +200,12 @@ class MorphToMany extends BelongsToMany
|
|||
// 关联查询封装
|
||||
$tableName = $this->query->getTable();
|
||||
$table = $this->pivot->db()->getTable();
|
||||
$fields = $this->getQueryFields($tableName);
|
||||
|
||||
if ($this->withoutField) {
|
||||
$this->query->withoutField($this->withoutField);
|
||||
}
|
||||
|
||||
$fields = $this->getQueryFields($tableName);
|
||||
|
||||
if ($this->withLimit) {
|
||||
$this->query->limit($this->withLimit);
|
||||
|
|
|
|||
|
|
@ -305,6 +305,8 @@ abstract class OneToOne extends Relation
|
|||
|
||||
if ($this->withField) {
|
||||
$this->query->field($this->withField);
|
||||
} elseif ($this->withoutField) {
|
||||
$this->query->withoutField($this->withoutField);
|
||||
}
|
||||
|
||||
$list = $this->query
|
||||
|
|
|
|||
Loading…
Reference in New Issue