/**
* MySQL to Date format
*
* @param  string
* @return string
*/
function db2Date($date, $with_time = true)
{
    if (!empty($date)) {
        $date = DateTime::createFromFormat('Y-m-d H:i', substr($date, 0, -3));
        return $date->format(GET_DATETIME($with_time));
    }
    return GET_DATETIME($with_time);
}
    }
    $query = DB::table('files')->where($attribute, '=', $value . '.' . $ext);
    return $query->count() == 0;
});
Validator::register('valid_datetime', function ($attribute, $value, $parameters) {
    //match the format of the date
    if (!empty($value)) {
        $d = DateTime::createFromFormat(GET_DATETIME(), $value);
        return !$d ? false : true;
    }
    return false;
});
Validator::register('valid_date', function ($attribute, $value, $parameters) {
    //match the format of the date
    if (!empty($value)) {
        $d = DateTime::createFromFormat(GET_DATETIME(false), $value);
        return !$d ? false : true;
    }
    return false;
});
// BLADE MODIFICATION
Blade::extend(function ($value) {
    return preg_replace('/\\{\\{([^\\-].+?)\\}\\}/s', '<?php echo $1; ?>', $value);
});
//BUNDLE CONSTANTS
define('USERNAME', Session::get('USERNAME'));
define('AUTHORID', Session::get('AUTHORID'));
define('ROLE', Session::get('ROLE', 0));
define('LANG', Session::get('LANG', Config::get('cms::settings.language')));
define('CMSLANG', Session::get('CMSLANG', Config::get('cms::settings.language')));
define('CACHE', Config::get('cms::settings.cache_engine'));
 public function get_datetime_off()
 {
     return date(GET_DATETIME(), strtotime($this->get_attribute('datetime_off')));
 }