3
3
use GeneaLabs \LaravelModelCaching \Traits \CachePrefixing ;
4
4
use Illuminate \Database \Eloquent \Model ;
5
5
use Illuminate \Database \Query \Builder ;
6
+ use Illuminate \Support \Arr ;
6
7
use Illuminate \Support \Collection ;
7
8
use Illuminate \Database \Query \Expression ;
8
9
use Illuminate \Database \Eloquent \Relations \HasMany ;
10
+ use Illuminate \Support \Str ;
9
11
10
12
class CacheKey
11
13
{
@@ -62,13 +64,13 @@ protected function getLimitClause() : string
62
64
63
65
protected function getTableSlug () : string
64
66
{
65
- return str_slug ($ this ->model ->getTable ())
67
+ return Str:: slug ($ this ->model ->getTable ())
66
68
. ": " ;
67
69
}
68
70
69
71
protected function getModelSlug () : string
70
72
{
71
- return str_slug (get_class ($ this ->model ));
73
+ return Str:: slug (get_class ($ this ->model ));
72
74
}
73
75
74
76
protected function getOffsetClause () : string
@@ -87,7 +89,7 @@ protected function getOrderByClauses() : string
87
89
return $ orders
88
90
->reduce (function ($ carry , $ order ) {
89
91
if (($ order ["type " ] ?? "" ) === "Raw " ) {
90
- return $ carry . "_orderByRaw_ " . str_slug ($ order ["sql " ]);
92
+ return $ carry . "_orderByRaw_ " . Str:: slug ($ order ["sql " ]);
91
93
}
92
94
93
95
return $ carry . "_orderBy_ " . $ order ["column " ] . "_ " . $ order ["direction " ];
@@ -127,7 +129,7 @@ protected function getValuesClause(array $where = null) : string
127
129
128
130
protected function getValuesFromWhere (array $ where ) : string
129
131
{
130
- if (array_get ($ where , "query " )) {
132
+ if (Arr:: get ($ where , "query " )) {
131
133
$ prefix = $ this ->getCachePrefix ();
132
134
$ subKey = (new self ($ this ->eagerLoad , $ this ->model , $ where ["query " ]))
133
135
->make ();
@@ -139,11 +141,11 @@ protected function getValuesFromWhere(array $where) : string
139
141
return $ subKey ;
140
142
}
141
143
142
- if (is_array (array_get ($ where , "values " ))) {
144
+ if (is_array (Arr:: get ($ where , "values " ))) {
143
145
return implode ("_ " , collect ($ where ["values " ])->flatten ()->toArray ());
144
146
}
145
147
146
- return array_get ($ where , "value " , "" );
148
+ return Arr:: get ($ where , "value " , "" );
147
149
}
148
150
149
151
protected function getValuesFromBindings (array $ where , string $ values ) : string
0 commit comments