File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 11<?php
22
3- if (!function_exists ('session ' )) {
3+ if (!function_exists ('session ' ) && class_exists ( ' Leaf\App ' ) ) {
44 /**
55 * Return session data/object or set session data
66 *
1010 function session ($ key = null , $ value = null )
1111 {
1212 if (!$ key && !$ value ) {
13- return new \Leaf \Http \Session ();
13+ if (!(\Leaf \Config::get ("session.instance " ))) {
14+ \Leaf \Config::set ("session.instance " , new \Leaf \Http \Session ());
15+ }
16+
17+ return \Leaf \Config::get ("session.instance " );
1418 }
1519
1620 if (!$ value && ($ key && is_string ($ key ))) {
@@ -25,7 +29,7 @@ function session($key = null, $value = null)
2529 }
2630}
2731
28- if (!function_exists ('flash ' )) {
32+ if (!function_exists ('flash ' ) && class_exists ( ' Leaf\App ' ) ) {
2933 /**
3034 * Return flash data/object or set flash data
3135 *
@@ -35,7 +39,11 @@ function session($key = null, $value = null)
3539 function flash ($ key = null , $ value = null )
3640 {
3741 if (!$ key && !$ value ) {
38- return new \Leaf \Flash ();
42+ if (!(\Leaf \Config::get ("flash.instance " ))) {
43+ \Leaf \Config::set ("flash.instance " , new \Leaf \Flash ());
44+ }
45+
46+ return \Leaf \Config::get ("flash.instance " );
3947 }
4048
4149 if (!$ value && is_string ($ key )) {
You can’t perform that action at this time.
0 commit comments