Skip to content

Commit a30586a

Browse files
move all method into trait
1 parent db51a86 commit a30586a

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/CachedModel.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,4 @@ public function newEloquentBuilder($query)
2525

2626
return new Builder($query);
2727
}
28-
29-
public static function all($columns = ['*'])
30-
{
31-
$class = get_called_class();
32-
$instance = new $class;
33-
$tags = [str_slug(get_called_class())];
34-
$key = $instance->makeCacheKey();
35-
36-
return $instance->cache($tags)
37-
->rememberForever($key, function () use ($columns) {
38-
return parent::all($columns);
39-
});
40-
}
4128
}

src/Traits/Cachable.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,17 @@ public static function bootCachable()
6767
$instance->flushCache();
6868
});
6969
}
70+
71+
public static function all($columns = ['*'])
72+
{
73+
$class = get_called_class();
74+
$instance = new $class;
75+
$tags = [str_slug(get_called_class())];
76+
$key = $instance->makeCacheKey();
77+
78+
return $instance->cache($tags)
79+
->rememberForever($key, function () use ($columns) {
80+
return parent::all($columns);
81+
});
82+
}
7083
}

0 commit comments

Comments
 (0)