Skip to content

Commit

Permalink
✨ added support for functional mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mychidarko committed Dec 31, 2021
1 parent d80bf25 commit 75687a7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"ext-mysqli": "*"
"ext-mysqli": "*",
"leafs/form": "^1.0"
}
}
}
18 changes: 18 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

if (!function_exists('db') && class_exists('Leaf\App')) {
/**
* Return the database object
*
* @return \Leaf\Db
*/
function db()
{
if (!(app()->config('db.instance'))) {
$db = new \Leaf\Db;
app()->config('db.instance', $db);
}

return app()->config('db.instance');
}
}

0 comments on commit 75687a7

Please sign in to comment.