Skip to content

Commit

Permalink
为模型新增一个创建查询对象方法
Browse files Browse the repository at this point in the history
  • Loading branch information
YepYuYu authored and liu21st committed Jul 5, 2023
1 parent dfe4baa commit efbd50b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,14 @@ public static function connect(string $connection)
return $model;
}

/**
* 创建一个查询对象
*/
public static function query(): Query
{
return (new static())->db();
}

public function __call($method, $args)
{
if (isset(static::$macro[static::class][$method])) {
Expand Down

0 comments on commit efbd50b

Please sign in to comment.