Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"illuminate/database": "^5.4",
"illuminate/events": "^5.4",
"phpmailer/phpmailer": "^5.2",
"spipu/html2pdf": "^5.0"
"spipu/html2pdf": "^5.0",
"filp/whoops": "^2.5"
},
"config": {
"secure-http": false
}
}
}
143 changes: 125 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 35 additions & 25 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,19 @@
* @Contact me: vinaykhobragade99@gmail.com
* @Github: github.com/feat7
*/

use \app\config\Config;
use Illuminate\Events\Dispatcher;
use \Whoops\Handler\PrettyPageHandler;

// Set the event dispatcher used by Eloquent models... (optional)
use Illuminate\Container\Container;
use Illuminate\Database\Capsule\Manager as Capsule;

if(!file_exists(__DIR__ . "/env.config.php")){
exit("Environment file not found. Please coyp env.config.example.php to env.config.php or see the documentation for more details");
if (! file_exists(__DIR__ . '/env.config.php')) {
exit('Environment file not found. Please coyp env.config.example.php to env.config.php or see the documentation for more details');
}
require_once 'env.config.php';

if(APP_MODE == '__DEV__')
ini_set('display_errors', 'on'); //Just for development mode

require_once 'env.config.php';

session_start(); //The game begins

Expand All @@ -29,52 +30,61 @@
$loader->add('system', __DIR__);
$loader->add('app', __DIR__);

if (APP_MODE == '__DEV__') {
ini_set('display_errors', 'on');

//Just for development mode
$whoops = new \Whoops\Run();
$whoops->prependHandler(new PrettyPageHandler());
$whoops->register();
} else if (APP_MODE == '__PRODUCTION__') {
ini_set('display_errors', 'off');
}



/**
* @Let us eat a capsule to use eloquent
*/

$capsule = new Capsule;
$capsule = new Capsule();

$capsule->addConnection([
'driver' => 'mysql',
'host' => DB_HOST,
'database' => DB_NAME,
'username' => DB_USER,
'password' => DB_PASS,
'charset' => 'utf8',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
]);

// Set the event dispatcher used by Eloquent models... (optional)
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$capsule->setEventDispatcher(new Dispatcher(new Container));
$capsule->setEventDispatcher(new Dispatcher(new Container()));

// Make this Capsule instance available globally via static methods... (optional)
$capsule->setAsGlobal();

// Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
$capsule->bootEloquent(); //eloquent boot done


$kernel = new system\Kernel(); //boot kernel

/**
* @function view
* @param view: string | path to view template
* @param view: string | path to view template
* @param vars: array | inject variabes into view template
* @param mixed $view
* @param mixed $vars
*/

function view($view, $vars = [])
{
$twigLoader = new Twig_Loader_Filesystem('./app/views');
$twig = new Twig_Environment($twigLoader, array(
'cache' => './app/cache',
'auto_reload' => true,
'debug' => true
));
$twigLoader = new Twig_Loader_Filesystem('./app/views');
$twig = new Twig_Environment($twigLoader, [
'cache' => './app/cache',
'auto_reload' => true,
'debug' => true,
]);
$twig->addExtension(new Twig_Extension_Debug());
$template = $twig->loadTemplate($view);
echo $template->render($vars);
$template = $twig->loadTemplate($view);
echo $template->render($vars);
}