예제 #1
0
    //If config is empty and if the user is not running the installer, Show error
    if (!$config && !$isInstalling) {
        if (!DB::connection()) {
            return Response::configurationError("Oops! The database cant be read!", "Database Connection error");
        } else {
            return Response::configurationError("Oops! The database is not configured properly!", "Database Configuration error");
        }
    }
});
App::before(function ($request) {
    //dd($request->getPathInfo() == route(Config::get('app-installer::routeName'), [], false));
    App::singleton('siteConfig', function () {
        //Loading config
        $config = array(0);
        try {
            $configRows = SiteConfig::all();
        } catch (Exception $e) {
            //Config cant be read! DB cant be accessed or Installation not completed
            //return Response::configurationError("Please complete installation and check again.", "Installation incomplete!");
            return false;
        }
        foreach ($configRows as $row) {
            $config[$row->name] = (array) json_decode($row->value, true);
        }
        return $config;
    });
    $config = app('siteConfig');
    //If config is empty, skip the rest
    if (!$config) {
        return;
    }