Skip to content

Commit adf0795

Browse files
committed
IHF: Laravel helpers added.
1 parent 7f6e234 commit adf0795

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/laravel.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\DB;
4+
5+
if (!function_exists('laravel_db_is_mysql')) {
6+
function laravel_db_is_mysql()
7+
{
8+
return (DB::getDefaultConnection() == 'mysql');
9+
}
10+
}
11+
12+
if (!function_exists('laravel_db_mysql_now')) {
13+
function laravel_db_mysql_now()
14+
{
15+
$result = (array) DB::selectOne('select now() as now');
16+
return $result['now'];
17+
}
18+
}
19+
20+
if (!function_exists('laravel_db_mysql_variable')) {
21+
function laravel_db_mysql_variable($name)
22+
{
23+
$result = (array) DB::selectOne('show variables where variable_name = ?', [$name]);
24+
return (isset($result['Value']) ? $result['Value'] : false);
25+
}
26+
}

0 commit comments

Comments
 (0)