Fixed newModelBuilder not compatible with parent.

This commit is contained in:
李铭昕 2019-11-13 10:33:58 +08:00
parent 3a5a61f186
commit 83094d3cbb
2 changed files with 8 additions and 7 deletions

View File

@ -63,8 +63,8 @@ trait Cacheable
/**
* Increment a column's value by a given amount.
* @param mixed $column
* @param mixed $amount
* @param string $column
* @param float|int $amount
* @return int
*/
public function increment($column, $amount = 1, array $extra = [])
@ -86,8 +86,8 @@ trait Cacheable
/**
* Decrement a column's value by a given amount.
* @param mixed $column
* @param mixed $amount
* @param string $column
* @param float|int $amount
* @return int
*/
public function decrement($column, $amount = 1, array $extra = [])
@ -109,14 +109,15 @@ trait Cacheable
/**
* Create a new Model query builder for the model.
* @param QueryBuilder $query
*/
public function newModelBuilder(QueryBuilder $query): Builder
public function newModelBuilder($query): Builder
{
if ($this->useCacheBuilder) {
return new ModelCacheBuilder($query);
}
return new Builder($query);
return parent::newModelBuilder($query);
}
public function newQuery(bool $cache = false): Builder

View File

@ -19,7 +19,7 @@ interface CacheableInterface
{
public static function findFromCache($id): ?Model;
public static function findManyFromCache($ids): Collection;
public static function findManyFromCache(array $ids): Collection;
public function deleteCache(): bool;
}