File tree Expand file tree Collapse file tree 9 files changed +24
-13
lines changed Expand file tree Collapse file tree 9 files changed +24
-13
lines changed File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change 11<?php
22
3- $ routes = require ('routes.php ' );
3+ $ routes = require (base_path ( 'routes.php ' ) );
44
55$ uri = parse_url ($ _SERVER ['REQUEST_URI ' ])['path ' ];
66
99function routeToController ($ uri , $ routes )
1010{
1111 if (array_key_exists ($ uri , $ routes )) {
12- require $ routes [$ uri ];
12+ // dd($routes[$uri]);
13+ require base_path ($ routes [$ uri ]);
1314 } else {
1415 abort ();
1516 }
Original file line number Diff line number Diff line change 11<?php
22
3- require base_path ('Validator.php ' );
3+ require base_path ('Core/ Validator.php ' );
44
55$ config = require (base_path ('config.php ' ));
66$ db = new Database ($ config ['database ' ]);
Original file line number Diff line number Diff line change 99// const BASE_PATH = __DIR__ . '/../';
1010const BASE_PATH = __DIR__ . '/../ ' ;
1111
12- require BASE_PATH . 'functions.php ' ;
13- require base_path ('Database.php ' );
14- require base_path ('Response.php ' );
15- require base_path ('router.php ' );
12+ require BASE_PATH . 'Core/functions.php ' ;
13+
14+ // when class is not found, this function will be called
15+ // this thing autoload classes on demand
16+ // it lets us declare manually how we wanna go about importing classes
17+ // that has not already been explicitly or manually required/imported
18+ spl_autoload_register (function ($ class ) {
19+ // dd($class);
20+ require (base_path ("Core/ {$ class }.php " ));
21+ });
22+
23+ // require base_path('Database.php');
24+ // require base_path('Response.php');
25+ require base_path ('Core/router.php ' );
1626
1727
1828
Original file line number Diff line number Diff line change 1- <?php require ( ' views/ partials/head.php ' ); ?>
2- <?php require ( ' views/ partials/nav.php ' ); ?>
1+ <?php view ( ' partials/head.php ' ); ?>
2+ <?php view ( ' partials/nav.php ' ); ?>
33<main>
44 <div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
55 <h1 class="text-2xl font-bold">403 Unauthorized. You are not authorized to view this page.</h1>
88 </p>
99 </div>
1010</main>
11- <?php require ( ' views/ partials/footer.php ' ); ?>
11+ <?php view ( ' partials/footer.php ' ); ?>
Original file line number Diff line number Diff line change 1- <?php require ( ' views/ partials/head.php ' ); ?>
2- <?php require ( ' views/ partials/nav.php ' ); ?>
1+ <?php view ( ' partials/head.php ' ); ?>
2+ <?php view ( ' partials/nav.php ' ); ?>
33<main>
44 <div class="mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8">
55 <h1 class="text-2xl font-bold">404 Not Found</h1>
88 </p>
99 </div>
1010</main>
11- <?php require ( ' views/ partials/footer.php ' ); ?>
11+ <?php view ( ' partials/footer.php ' ); ?>
You can’t perform that action at this time.
0 commit comments