@@ -39,11 +39,11 @@ function d()
3939if (!function_exists ('dbRow ' )) {
4040 /**
4141 * Return a db row by it's id
42- *
42+ *
4343 * @param string $table The table to find row
4444 * @param string|int $row_id The row's id
4545 * @param string $columns The columns to get
46- *
46+ *
4747 * @return array|null The database field
4848 */
4949 function dbRow ($ table , $ row_id , $ columns = "* " )
@@ -56,7 +56,7 @@ function dbRow($table, $row_id, $columns = "*")
5656if (!function_exists ('email ' )) {
5757 /**
5858 * Write and send an email
59- *
59+ *
6060 * @param array $email The email block to write and send
6161 */
6262 function email (array $ email )
@@ -86,6 +86,16 @@ function fs()
8686 }
8787}
8888
89+ if (!function_exists ('flash ' )) {
90+ /**
91+ * Return Leaf's flash object
92+ */
93+ function flash ()
94+ {
95+ return \Leaf \Flash::class;
96+ }
97+ }
98+
8999if (!function_exists ('hasAuth ' )) {
90100 /**
91101 * Find out if there's an active sesion
@@ -99,9 +109,9 @@ function hasAuth()
99109if (!function_exists ('json ' )) {
100110 /**
101111 * json uses Leaf's now `json` method
102- *
112+ *
103113 * json() packs in a bunch of functionality and customization into one method
104- *
114+ *
105115 * @param array|string|object $data The data to output
106116 * @param int $code HTTP Status code for response, it's set in header
107117 * @param bool $showCode Show response code in response body?
@@ -116,7 +126,7 @@ function json($data, int $code = 200, bool $showCode = false, bool $useMessage =
116126if (!function_exists ('markup ' )) {
117127 /**
118128 * Output markup as response
119- *
129+ *
120130 * @param string $data The markup to output
121131 * @param int $code The http status code
122132 */
@@ -147,7 +157,7 @@ function render(string $view, array $data = [], array $mergeData = [])
147157if (!function_exists ('request ' )) {
148158 /**
149159 * Return request or request data
150- *
160+ *
151161 * @param array|string $data — Get data from request
152162 */
153163 function request ($ data = null )
@@ -160,7 +170,7 @@ function request($data = null)
160170if (!function_exists ('requestBody ' )) {
161171 /**
162172 * Get request body
163- *
173+ *
164174 * @param bool $safeData — Sanitize output
165175 */
166176 function requestBody ($ safeOutput = true )
@@ -172,7 +182,7 @@ function requestBody($safeOutput = true)
172182if (!function_exists ('requestData ' )) {
173183 /**
174184 * Get request data
175- *
185+ *
176186 * @param string|array $param The item(s) to get from request
177187 * @param bool $safeData — Sanitize output
178188 */
@@ -186,7 +196,7 @@ function requestData($param, $safeOutput = true, $assoc = false)
186196if (!function_exists ('response ' )) {
187197 /**
188198 * Return response or set response data
189- *
199+ *
190200 * @param array|string $data — The JSON response to set
191201 */
192202 function response ($ data = null )
@@ -211,7 +221,7 @@ function Route($methods, $pattern, $fn)
211221if (!function_exists ('session ' )) {
212222 /**
213223 * Get a session variable or the session object
214- *
224+ *
215225 * @param string|null $key The variable to get
216226 */
217227 function session ($ key = null )
@@ -237,7 +247,7 @@ function sessionUser()
237247if (!function_exists ('setHeader ' )) {
238248 /**
239249 * Set a response header
240- *
250+ *
241251 * @param string|array $key The header key
242252 * @param string $value Header value
243253 * @param bool $replace Replace header if exists
@@ -271,7 +281,7 @@ function throwErr($error, int $code = 500, bool $useMessage = false)
271281if (!function_exists ('view ' )) {
272282 /**
273283 * Return a blade view
274- *
284+ *
275285 * @param string $view The view to return
276286 * @param array $data Data to pass into app
277287 * @param array $mergeData
@@ -283,6 +293,17 @@ function view(string $view, array $data = [], array $mergeData = [])
283293 }
284294}
285295
296+ // App
297+
298+ /**
299+ * Get app configuration
300+ */
301+ function AppConfig ($ setting = null )
302+ {
303+ $ config = require __DIR__ . "/app.php " ;
304+ return !$ setting ? $ config : $ config [$ setting ];
305+ }
306+
286307// Auth
287308
288309/**
@@ -334,7 +355,7 @@ function config_path($path = null)
334355}
335356
336357/**
337- * Storage directory path
358+ * Storage directory path
338359 */
339360function storage_path ($ path = null , bool $ slash = false )
340361{
0 commit comments