fix headre

This commit is contained in:
Kavalar 2024-07-29 16:07:51 +03:00
parent 200763725e
commit f24ce58b85
4 changed files with 7 additions and 1 deletions

View File

@ -15,6 +15,7 @@ use http\Message;
use Itguild\Tables\ListJsonTable;
use Itguild\Tables\ViewJsonTable;
use JetBrains\PhpStorm\NoReturn;
use kernel\App;
use kernel\Controller;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\IGTabel\ListJsonTableEloquentCollection;
@ -62,6 +63,7 @@ class UserController extends Controller{
{
// $users = User::where(['role' => 1])->get();
$users = User::all();
//App::$header->add("asd", "asd");
$this->cgView->render("user/index.php", ['users' => $users]);
}

View File

@ -5,6 +5,7 @@ $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
include_once __DIR__ . "/bootstrap/db.php";
include_once __DIR__ . "/bootstrap/header.php";
const ROOT_DIR = __DIR__;
const KERNEL_DIR = __DIR__ . "/kernel";
const CONSOLE_DIR = __DIR__ . "/kernel/console";

3
bootstrap/header.php Normal file
View File

@ -0,0 +1,3 @@
<?php
\kernel\App::$header = new \kernel\Header();

View File

@ -22,7 +22,7 @@ class App
{
$dispatcher = new Dispatcher(App::$collector->getData());
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
header('Content-Type: ' . App::$responseType);
//header('Content-Type: ' . App::$responseType);
App::$header->set();
echo $response;
}