Repository navigation
Expand file tree
/
Copy pathbootstrap.php
More file actions
79 lines (53 loc) · 2 KB
/
Copy pathbootstrap.php
File metadata and controls
79 lines (53 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
require "config/database.php";
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Http\Request;
use Illuminate\Pagination\Paginator;
use Illuminate\View\Engines\EngineResolver;
use Illuminate\View\Engines\PhpEngine;
use Illuminate\View\Factory;
use Illuminate\View\FileViewFinder;
use Illuminate\View\ViewServiceProvider;
use Illuminate\Html\HtmlServiceProvider;
use Illuminate\Routing\Router;
/*$app['config'] = $app->share(function () {
return Yaml::parse(file_get_contents(__DIR__.'/app/config.yml'));
});*/
$db = vaah_db_config();
/*
$app = new \Slim\Slim();
$app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware);*/
$events = new Dispatcher(new Container);
$pathsToTemplates = [__DIR__ . '/templates'];
$filesystem = new Filesystem;
$viewResolver = new EngineResolver;
$viewResolver->register('php', function () {
return new PhpEngine;
});
$viewFinder = new FileViewFinder($filesystem, $pathsToTemplates);
$viewFactory = new Factory($viewResolver, $viewFinder, $events);
//Set Pagination Variable
// Set the view factory resolver
Paginator::viewFactoryResolver(function () use ($viewFactory) {
return $viewFactory;
});
$pageName = 'page_number';
// Set up a current path resolver so the paginator can generate proper links
Paginator::currentPathResolver(function () {
return isset($_SERVER['REQUEST_URI']) ? strtok($_SERVER['REQUEST_URI'], '?') : '/';
});
// Set up a current page resolver
Paginator::currentPageResolver(function ($pageName) {
$page = isset($_REQUEST[$pageName]) ? $_REQUEST[$pageName] : 1;
return $page;
});
$capsule = new Capsule;
$capsule->addConnection($db);
$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();