Skip to content
Snippets Groups Projects
Commit 47a58436 authored by Kbida Vincent's avatar Kbida Vincent
Browse files
parents 8bdf3814 c3ab995f
No related branches found
No related tags found
No related merge requests found
<?php <?php
use bdd\controleur\ControleurRequete;
use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Capsule\Manager as DB;
$db = new DB(); $db = new DB();
//SI CA NE FONCTIONNE PAS, ENLEVER LES COMMENTAIRES : CES INFOS SONT DEJA DANS LE CONF.INI //SI CA NE FONCTIONNE PAS, ENLEVER LES COMMENTAIRES : CES INFOS SONT DEJA DANS LE CONF.INI
...@@ -30,10 +32,8 @@ $db->addConnection([ ...@@ -30,10 +32,8 @@ $db->addConnection([
$db->setAsGlobal(); $db->setAsGlobal();
$db->bootEloquent(); $db->bootEloquent();
// demerage d'un session
session_start(); session_start();
// intance de slim qui a pour but de créer le rootage des urls
$app = new Slim(); $app = new Slim();
$app->get('/', function () { $app->get('/', function () {
...@@ -41,15 +41,19 @@ $app->get('/', function () { ...@@ -41,15 +41,19 @@ $app->get('/', function () {
$v->renderHome(); $v->renderHome();
})->name('accueil'); })->name('accueil');
$app->get('/ex1/requete1', function () { $app->get('/ex1/requete1', function () {
$c = new ControleurRequete();
$c->selectMario();
})->name('ex1 requete 1'); })->name('ex1 requete 1');
$app->get('/ex1/requete2', function () { $app->get('/ex1/requete2', function () {
$c = new ControleurRequete();
})->name('ex1 requete 2'); })->name('ex1 requete 2');
$app->get('/ex1/requete3', function () { $app->get('/ex1/requete3', function () {
$c = new ControleurRequete();
})->name('ex1 requete 3'); })->name('ex1 requete 3');
$app->get('/ex1/requete4', function () { $app->get('/ex1/requete4', function () {
$c = new ControleurRequete();
})->name('ex1 requete 4'); })->name('ex1 requete 4');
......
<?php
use Slim\Slim;
class Requete1
{
protected $tab, $app;
public function __construct($t)
{
$this->tab = $t;
$this->app = Slim::getInstance();
}
public function render($type)
{
switch ($type) {
case 1:
return $this->default();
break;
default:
return $this->notFound();
break;
}
}
private function notFound()
{
$res .= <<<RES
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
</head>
<body>
<p>data not found</p>
</body>
</html>
RES;
}
private function default()
{
$res .= <<<RES
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
</head>
<body>
RES;
foreach ($this->tab as $key => $value) {
$res .= <<<RES
$key:$value
RES;
}
$res .= <<<RES
</body>
</html>
RES;
return $res;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment