Skip to content

Commit 75305c9

Browse files
committed
feat: use new fn mode API
1 parent 85f18c4 commit 75305c9

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/functions.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
*/
99
function session()
1010
{
11-
if (!(\Leaf\Config::get('session.instance'))) {
12-
\Leaf\Config::set('session.instance', new \Leaf\Http\Session());
11+
if (!(\Leaf\Config::getStatic('session'))) {
12+
\Leaf\Config::singleton('session', function () {
13+
return new \Leaf\Http\Session();
14+
});
1315
}
1416

15-
return \Leaf\Config::get('session.instance');
17+
return \Leaf\Config::get('session');
1618
}
1719
}
1820

@@ -24,10 +26,12 @@ function session()
2426
*/
2527
function flash()
2628
{
27-
if (!(\Leaf\Config::get('flash.instance'))) {
28-
\Leaf\Config::set('flash.instance', new \Leaf\Flash());
29+
if (!(\Leaf\Config::getStatic('flash'))) {
30+
\Leaf\Config::singleton('flash', function () {
31+
return new \Leaf\Flash();
32+
});
2933
}
3034

31-
return \Leaf\Config::get('flash.instance');
35+
return \Leaf\Config::get('flash');
3236
}
3337
}

0 commit comments

Comments
 (0)