升级到v5128lts

This commit is contained in:
cxdbz committed 2018-11-28 22:00:19 +08:00
1 parent a139519dec
commit dbefa7f320
30 files changed
+184 -117

No files matched your search

@@ -80,6 +80,8 @@ trait ModelEvent
*/
public static function observe($class)
{
self::flushEvent();
foreach (static::$observe as $event) {
$eventFuncName = Loader::parseName($event, 1, false);
@@ -212,7 +212,7 @@ trait SoftDelete
return false;
}
if (!strpos($field, '.')) {
if (false === strpos($field, '.')) {
$field = '__TABLE__.' . $field;
}
@@ -135,7 +135,19 @@ class BelongsTo extends OneToOne
*/
public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER')
{
return $this->parent;
$table = $this->query->getTable();
$model = basename(str_replace('\\', '/', get_class($this->parent)));
$relation = basename(str_replace('\\', '/', $this->model));
$localKey = $this->localKey;
$foreignKey = $this->foreignKey;
return $this->parent->db()
->alias($model)
->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) {
$query->table([$table => $relation])
->field($relation . '.' . $localKey)
->whereExp($model . '.' . $foreignKey, '=' . $relation . '.' . $localKey);
});
}
/**
Loaded 3 of 30 files, more files were not shown because too many files have changed in this diff. Show more