Commit 60e0216a authored by SASSU Thomas's avatar SASSU Thomas
Browse files

fonction eloquent et etc

parent 0dd30a37
{ {
"require":{ "require":{
"illuminate/database": "5.5.*", "illuminate/database": "5.5.*",
"illuminate/pagination": ">=5.0",
"php": ">=7.0", "php": ">=7.0",
"slim/slim": "2.*" "slim/slim": "2.*"
}, },
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "58ad4665ea57037daa2176094db2d412", "content-hash": "cc18e66e95cadfdfa2cb91becd1b4524",
"packages": [ "packages": [
{ {
"name": "doctrine/inflector", "name": "doctrine/inflector",
...@@ -220,6 +220,50 @@ ...@@ -220,6 +220,50 @@
], ],
"time": "2018-09-23T18:58:54+00:00" "time": "2018-09-23T18:58:54+00:00"
}, },
{
"name": "illuminate/pagination",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/illuminate/pagination.git",
"reference": "686b121987164d161fe3440f407014ad026bdbbc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/pagination/zipball/686b121987164d161fe3440f407014ad026bdbbc",
"reference": "686b121987164d161fe3440f407014ad026bdbbc",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.5.*",
"illuminate/support": "5.5.*",
"php": ">=7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Pagination\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "The Illuminate Pagination package.",
"homepage": "https://laravel.com",
"time": "2017-10-13T15:07:13+00:00"
},
{ {
"name": "illuminate/support", "name": "illuminate/support",
"version": "v5.5.44", "version": "v5.5.44",
...@@ -529,16 +573,16 @@ ...@@ -529,16 +573,16 @@
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.13.1", "version": "v1.14.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -550,7 +594,7 @@ ...@@ -550,7 +594,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.13-dev" "dev-master": "1.14-dev"
} }
}, },
"autoload": { "autoload": {
...@@ -584,20 +628,20 @@ ...@@ -584,20 +628,20 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2019-11-27T14:18:11+00:00" "time": "2020-01-13T11:15:53+00:00"
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v4.4.3", "version": "v4.4.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c" "reference": "0a19a77fba20818a969ef03fdaf1602de0546353"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/f5d2ac46930238b30a9c2f1b17c905f3697d808c", "url": "https://api.github.com/repos/symfony/translation/zipball/0a19a77fba20818a969ef03fdaf1602de0546353",
"reference": "f5d2ac46930238b30a9c2f1b17c905f3697d808c", "reference": "0a19a77fba20818a969ef03fdaf1602de0546353",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -660,7 +704,7 @@ ...@@ -660,7 +704,7 @@
], ],
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2020-01-15T13:29:06+00:00" "time": "2020-02-04T09:32:40+00:00"
}, },
{ {
"name": "symfony/translation-contracts", "name": "symfony/translation-contracts",
......
...@@ -3,9 +3,11 @@ require_once __DIR__ . '/vendor/autoload.php'; ...@@ -3,9 +3,11 @@ require_once __DIR__ . '/vendor/autoload.php';
session_start(); session_start();
use \Slim\Slim as Slim; use \Slim\Slim as Slim;
use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Capsule\Manager as DB;
use \gp\controleurs\ControleurPrincipal as ControleurPrincipal;
use \gp\controleurs\ControleurScript as ControleurScript;
$db = new DB(); $db = new DB();
$db->addConnection(parse_ini_file('./src/conf/conf.ini')); $db->addConnection(parse_ini_file('./conf/conf.ini'));
$db->setAsGlobal(); $db->setAsGlobal();
$db->bootEloquent(); $db->bootEloquent();
...@@ -13,169 +15,15 @@ $db->bootEloquent(); ...@@ -13,169 +15,15 @@ $db->bootEloquent();
$app = new \Slim\Slim(); $app = new \Slim\Slim();
$app->get('/',function () { $app->get('/',function () {
$c = new \fridgie\controleurs\ControleurPrincipal(); $c = new ControleurPrincipal();
$c->afficherAccueil(); // $c->afficherAccueil();
}); });
/* $app->get('/script_TD1/',function () {
* ---------------------------------------------------------------- $c = new ControleurScript();
* Controleur Recette $c->td1();
* ----------------------------------------------------------------
*/
$app->get('/indexrecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->indexRecette();
});
$app->get('/recette',function () {
$c = new \fridgie\controleurs\ControleurRecette();
$c->getRecette();
});
$app->post('/recette',function () {
$c = new \fridgie\controleurs\ControleurRecette();
$c->afficherRecette();
});
$app->get('/afficherrecette/:id',function ($id) {
$c = new \fridgie\controleurs\ControleurRecette();
$c->afficherRecetteId($id);
});
$app->get('/nouvellerecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->formulaireInsererRecette();
});
$app->post('/nouvellerecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->traitementformulaireInsererRecette();
});
$app->get('/rechercherecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->formulaireRechercheRecette();
});
$app->post('/rechercherecette', function() {
$c = new \fridgie\controleurs\ControleurRecette();
$c->traitementFormulaireRechercheRecette();
});
/*
* ----------------------------------------------------------------
* Controleur Evenement
* ----------------------------------------------------------------
*/
$app->get('/indexevenement', function() {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->indexEvenement();
});
$app->get('/creationevenement',function () {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->creerEvenement();
});
$app->post('/creationevenement',function () {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->creerEvenementPost();
});
$app->get('/afficherevenements', function() {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->afficherEvenements();
});
$app->get('/afficherevenement/:token',function ($token) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->afficherEvenement($token);
}); });
//$app->get('/participerevenement/:token', function($token) {
// $c = new \fridgie\controleurs\ControleurEvenement();
// $c->participerEvenement($token);
//});
$app->post('/participerevenement/:token', function($token) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->participerEvenementPost($token);
});
//par nom
$app->get('/rechercheevenement/:recherche',function ($recherche) {
$c = new \fridgie\controleurs\ControleurEvenement();
$c->rechercheEvenement($recherche);
});
/*
* ----------------------------------------------------------------
* Controleur Ingredient
* ----------------------------------------------------------------
*/
$app->post('/apporteringredient/:token', function($token) { //token = token de l'event
$c = new \fridgie\controleurs\ControleurIngredient();
$c->apporterIngredient($token);
header('Location: ../afficherevenement/' . $token);
exit();
});
$app->get('/apporteringredient/:token', function($token) { //token = token de l'event
$c = new \fridgie\controleurs\ControleurIngredient();
$c->apporterIngredientForm($token);
});
$app->get('/ingredient/:id', function($id) { //id = id de l'ingredient à afficher
$c = new \fridgie\controleurs\ControleurIngredient();
$c->afficherIngredient($id);
});
/*
* ----------------------------------------------------------------
* Controleur Client
* ----------------------------------------------------------------
*/
$app->get('/inscription', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->creerCompte();
});
$app->post('/inscription', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->traitementInscription();
});
$app->get('/connexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
if (isset($_SESSION['Connexion']) == true) {
header('Location: ./moncompte');
exit();
}
else $c->identification();
});
$app->post('/connexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->traitementIdentification();
});
$app->post('/deconnexion', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->deconnexion();
});
$app->get('/moncompte', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->afficherCompte();
});
$app->post('/suppression', function() {
$c = new \fridgie\controleurs\ControleurClient();
$c->delete();
});
$app->run(); $app->run();
\ No newline at end of file
<?php
require_once __DIR__ . '../vendor/autoload.php';
session_start();
use \Slim\Slim as Slim;
use Illuminate\Database\Capsule\Manager as DB;
use \gp\controleurs\ControleurPrincipal as ControleurPrincipal;
use \gp\controleurs\ControleurScript as ControleurScript;
$db = new DB();
$db->addConnection(parse_ini_file('./conf/conf.ini'));
$db->setAsGlobal();
$db->bootEloquent();
$c = new ControleurScript();
$c->td1();
<?php
namespace gp\controleurs;
use gp\modeles\Platform;
use gp\modeles\Game;
use gp\modeles\Company;
use gp\modeles\Deck;
class ControleurScript
{
public function td1(){
echo "script TD1";
$tab=null;
$tab[] = $this->gameByName('Mario')->get();
$tab[] = $this->CompanyByCountry('Japan')->get();
$tab[] = $this->platformByBase('10000000')->get();
$tab[] = Game::skip(21173)->take(442)->get();
$data = Game::simplePaginate(500);
$s = "<p>--------------------------------------------------------<br>".
"Jeu contenant dans leur nom 'Mario'<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[0] as $game){
echo ("<p>{$game->name}</p>");
}
$s= "<p>--------------------------------------------------------<br>".
"Compagnies installées au 'Japon'<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[1] as $company){
echo ("<p>{$company->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"Plateformes dont la base installée est >= 10 000 000<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[2] as $plat){
echo ("<p>{$plat->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"liste de 442 jeux à partir du 21173ème<br>".
"--------------------------------------------------------</p>";
echo $s;
foreach ($tab[3] as $game){
echo ("<p>{$game->name}</p>");
}
$s = "<p>--------------------------------------------------------<br>".
"liste des jeux en paginant (taille des pages : 500)<br>".
"--------------------------------------------------------</p>";
echo $s;
$res = "";
foreach ($data as $t){
$res = $res . "<p>$t->name</p>";
}
$res = "<div class=\"container\">
$res
</div>";
echo $res;
}
private function gameByName($name){
return Game::where("name", "like", "%{$name}%");
}
private function companyByCountry($country){
return Company::where("location_country", "like", "{$country}");
}
private function platformByBase($base){
return Platform::where("install_base", ">=", "{$base}");
}
}
\ No newline at end of file
...@@ -279,7 +279,7 @@ class ClassLoader ...@@ -279,7 +279,7 @@ class ClassLoader
*/ */
public function setApcuPrefix($apcuPrefix) public function setApcuPrefix($apcuPrefix)
{ {
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
} }
/** /**
...@@ -377,11 +377,11 @@ class ClassLoader ...@@ -377,11 +377,11 @@ class ClassLoader
$subPath = $class; $subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) { while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos); $subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\'; $search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) { if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) { foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . $pathEnd)) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file; return $file;
} }
} }
......
...@@ -6,12 +6,14 @@ $vendorDir = dirname(dirname(__FILE__)); ...@@ -6,12 +6,14 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir); $baseDir = dirname($vendorDir);
return array( return array(
'fridgie\\' => array($baseDir . '/src'), 'gp\\' => array($baseDir . '/src'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Contracts\\Translation\\' => array($vendorDir . '/symfony/translation-contracts'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'), 'Illuminate\\Support\\' => array($vendorDir . '/illuminate/support'),
'Illuminate\\Pagination\\' => array($vendorDir . '/illuminate/pagination'),
'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'), 'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'),
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'), 'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'), 'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'),
......
...@@ -12,13 +12,14 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 ...@@ -12,13 +12,14 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
); );
public static $prefixLengthsPsr4 = array ( public static $prefixLengthsPsr4 = array (
'f' => 'g' =>
array ( array (
'fridgie\\' => 8, 'gp\\' => 3,
), ),
'S' => 'S' =>
array ( array (
'Symfony\\Polyfill\\Mbstring\\' => 26, 'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Contracts\\Translation\\' => 30,
'Symfony\\Component\\Translation\\' => 30, 'Symfony\\Component\\Translation\\' => 30,
), ),
'P' => 'P' =>
...@@ -29,6 +30,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 ...@@ -29,6 +30,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
'I' => 'I' =>
array ( array (
'Illuminate\\Support\\' => 19, 'Illuminate\\Support\\' => 19,
'Illuminate\\Pagination\\' => 22,
'Illuminate\\Database\\' => 20, 'Illuminate\\Database\\' => 20,
'Illuminate\\Contracts\\' => 21, 'Illuminate\\Contracts\\' => 21,
'Illuminate\\Container\\' => 21, 'Illuminate\\Container\\' => 21,
...@@ -40,7 +42,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 ...@@ -40,7 +42,7 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
); );
public static $prefixDirsPsr4 = array ( public static $prefixDirsPsr4 = array (
'fridgie\\' => 'gp\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src', 0 => __DIR__ . '/../..' . '/src',
), ),
...@@ -48,6 +50,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 ...@@ -48,6 +50,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
array ( array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
), ),
'Symfony\\Contracts\\Translation\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/translation-contracts',
),
'Symfony\\Component\\Translation\\' => 'Symfony\\Component\\Translation\\' =>
array ( array (
0 => __DIR__ . '/..' . '/symfony/translation', 0 => __DIR__ . '/..' . '/symfony/translation',
...@@ -64,6 +70,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5 ...@@ -64,6 +70,10 @@ class ComposerStaticInit9dd92070b68bdceeba5acfcd17a6e4b5
array ( array (
0 => __DIR__ . '/..' . '/illuminate/support', 0 => __DIR__ . '/..' . '/illuminate/support',
), ),
'Illuminate\\Pagination\\' =>
array (
0 => __DIR__ . '/..' . '/illuminate/pagination',
),
'Illuminate\\Database\\' => 'Illuminate\\Database\\' =>
array ( array (
0 => __DIR__ . '/..' . '/illuminate/database', 0 => __DIR__ . '/..' . '/illuminate/database',
......
This diff is collapsed.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
{"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"}
], ],
"require": { "require": {
"php": "^7.0" "php": "^7.1"
}, },
"require-dev": {