Skip to content
Snippets Groups Projects
Commit d9dcced4 authored by SCHULER Killian's avatar SCHULER Killian
Browse files

copie tp2->tp3 et ajout des requetes eloquente dans controller

parent 78b29b81
No related branches found
No related tags found
No related merge requests found
RewriteEngine On
#
# RewriteBase indispensable sur webetu :
# RewriteBase /www/marcolet3u/php-project/
#
# Pour interdire l'accès aux répertoires contenant du code
RewriteRule ^sql(/.|)$ - [NC,F]
RewriteRule ^src(/.|)$ - [NC,F]
RewriteRule ^vendor(/.*|)$ - [NC,F]
#
# réécriture pour slim
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
\ No newline at end of file
{
"require": {
"illuminate/database": "5.5.*",
"slim/slim": "2.*",
"php": ">=7.0"
},
"autoload": {
"psr-4": {
"bdd\\": "./src"
}
}
}
\ No newline at end of file
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3e70f60fac24a2aa60eedcd9ce200f65",
"packages": [{
"name": "doctrine/inflector",
"version": "1.3.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"reference": "ec3a55242203ffa6a4b27c58176da97ff0a7aec1",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"inflection",
"pluralize",
"singularize",
"string"
],
"time": "2019-10-30T19:59:35+00:00"
},
{
"name": "illuminate/container",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/illuminate/container.git",
"reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/container/zipball/7917f4c86ecf7f4d0efcfd83248ad3e301e08858",
"reference": "7917f4c86ecf7f4d0efcfd83248ad3e301e08858",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.5.*",
"php": ">=7.0",
"psr/container": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Container\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}],
"description": "The Illuminate Container package.",
"homepage": "https://laravel.com",
"time": "2018-01-19T17:58:33+00:00"
},
{
"name": "illuminate/contracts",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/illuminate/contracts.git",
"reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/contracts/zipball/b2a62b4a85485fca9cf5fa61a933ad64006ff528",
"reference": "b2a62b4a85485fca9cf5fa61a933ad64006ff528",
"shasum": ""
},
"require": {
"php": ">=7.0",
"psr/container": "~1.0",
"psr/simple-cache": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Contracts\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}],
"description": "The Illuminate Contracts package.",
"homepage": "https://laravel.com",
"time": "2018-03-20T15:34:35+00:00"
},
{
"name": "illuminate/database",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/illuminate/database.git",
"reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/database/zipball/f5403b3dd774eb89ff0ef5e633e57458c3dc537d",
"reference": "f5403b3dd774eb89ff0ef5e633e57458c3dc537d",
"shasum": ""
},
"require": {
"illuminate/container": "5.5.*",
"illuminate/contracts": "5.5.*",
"illuminate/support": "5.5.*",
"php": ">=7.0"
},
"suggest": {
"doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.5).",
"fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).",
"illuminate/console": "Required to use the database commands (5.5.*).",
"illuminate/events": "Required to use the observers with Eloquent (5.5.*).",
"illuminate/filesystem": "Required to use the migrations (5.5.*).",
"illuminate/pagination": "Required to paginate the result set (5.5.*)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Database\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}],
"description": "The Illuminate Database package.",
"homepage": "https://laravel.com",
"keywords": [
"database",
"laravel",
"orm",
"sql"
],
"time": "2018-09-23T18:58:54+00:00"
},
{
"name": "illuminate/support",
"version": "v5.5.44",
"source": {
"type": "git",
"url": "https://github.com/illuminate/support.git",
"reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/illuminate/support/zipball/5c405512d75dcaf5d37791badce02d86ed8e4bc4",
"reference": "5c405512d75dcaf5d37791badce02d86ed8e4bc4",
"shasum": ""
},
"require": {
"doctrine/inflector": "~1.1",
"ext-mbstring": "*",
"illuminate/contracts": "5.5.*",
"nesbot/carbon": "^1.24.1",
"php": ">=7.0"
},
"replace": {
"tightenco/collect": "<5.5.33"
},
"suggest": {
"illuminate/filesystem": "Required to use the composer class (5.5.*).",
"symfony/process": "Required to use the composer class (~3.3).",
"symfony/var-dumper": "Required to use the dd function (~3.3)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.5-dev"
}
},
"autoload": {
"psr-4": {
"Illuminate\\Support\\": ""
},
"files": [
"helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}],
"description": "The Illuminate Support package.",
"homepage": "https://laravel.com",
"time": "2018-08-10T19:40:01+00:00"
},
{
"name": "kylekatarnls/update-helper",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/kylekatarnls/update-helper.git",
"reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/kylekatarnls/update-helper/zipball/5786fa188e0361b9adf9e8199d7280d1b2db165e",
"reference": "5786fa188e0361b9adf9e8199d7280d1b2db165e",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.1.0 || ^2.0.0",
"php": ">=5.3.0"
},
"require-dev": {
"codeclimate/php-test-reporter": "dev-master",
"composer/composer": "2.0.x-dev || ^2.0.0-dev",
"phpunit/phpunit": ">=4.8.35 <6.0"
},
"type": "composer-plugin",
"extra": {
"class": "UpdateHelper\\ComposerPlugin"
},
"autoload": {
"psr-0": {
"UpdateHelper\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Kyle",
"email": "kylekatarnls@gmail.com"
}],
"description": "Update helper",
"time": "2019-07-29T11:03:54+00:00"
},
{
"name": "myclabs/php-enum",
"version": "1.7.2",
"source": {
"type": "git",
"url": "https://github.com/myclabs/php-enum.git",
"reference": "45f01adf6922df6082bcda36619deb466e826acf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/php-enum/zipball/45f01adf6922df6082bcda36619deb466e826acf",
"reference": "45f01adf6922df6082bcda36619deb466e826acf",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "^4.8.35|^5.7|^6.0",
"squizlabs/php_codesniffer": "1.*"
},
"type": "library",
"autoload": {
"psr-4": {
"MyCLabs\\Enum\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "PHP Enum contributors",
"homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
}],
"description": "PHP Enum implementation",
"homepage": "http://github.com/myclabs/php-enum",
"keywords": [
"enum"
],
"time": "2019-08-19T13:53:00+00:00"
},
{
"name": "nesbot/carbon",
"version": "1.39.1",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/4be0c005164249208ce1b5ca633cd57bdd42ff33",
"reference": "4be0c005164249208ce1b5ca633cd57bdd42ff33",
"shasum": ""
},
"require": {
"kylekatarnls/update-helper": "^1.1",
"php": ">=5.3.9",
"symfony/translation": "~2.6 || ~3.0 || ~4.0"
},
"require-dev": {
"composer/composer": "^1.2",
"friendsofphp/php-cs-fixer": "~2",
"phpunit/phpunit": "^4.8.35 || ^5.7"
},
"bin": [
"bin/upgrade-carbon"
],
"type": "library",
"extra": {
"update-helper": "Carbon\\Upgrade",
"laravel": {
"providers": [
"Carbon\\Laravel\\ServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Brian Nesbitt",
"email": "brian@nesbot.com",
"homepage": "http://nesbot.com"
}],
"description": "A simple API extension for DateTime.",
"homepage": "http://carbon.nesbot.com",
"keywords": [
"date",
"datetime",
"time"
],
"time": "2019-10-14T05:51:36+00:00"
},
{
"name": "psr/container",
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/container.git",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Container\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}],
"description": "Common Container Interface (PHP FIG PSR-11)",
"homepage": "https://github.com/php-fig/container",
"keywords": [
"PSR-11",
"container",
"container-interface",
"container-interop",
"psr"
],
"time": "2017-02-14T16:28:37+00:00"
},
{
"name": "psr/simple-cache",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"time": "2017-10-23T01:57:42+00:00"
},
{
"name": "slim/slim",
"version": "2.6.3",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim.git",
"reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/9224ed81ac1c412881e8d762755e3d76ebf580c0",
"reference": "9224ed81ac1c412881e8d762755e3d76ebf580c0",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"suggest": {
"ext-mcrypt": "Required for HTTP cookie encryption",
"phpseclib/mcrypt_compat": "Polyfil for mcrypt extension"
},
"type": "library",
"autoload": {
"psr-0": {
"Slim": "."
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Josh Lockhart",
"email": "info@joshlockhart.com",
"homepage": "http://www.joshlockhart.com/"
}],
"description": "Slim Framework, a PHP micro framework",
"homepage": "http://github.com/codeguy/Slim",
"keywords": [
"microframework",
"rest",
"router"
],
"time": "2017-01-07T12:21:41+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.13.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
"reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2019-11-27T14:18:11+00:00"
},
{
"name": "symfony/translation",
"version": "v4.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "f7669f48a9633bf8139bc026c755e894b7206677"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/f7669f48a9633bf8139bc026c755e894b7206677",
"reference": "f7669f48a9633bf8139bc026c755e894b7206677",
"shasum": ""
},
"require": {
"php": "^7.1.3",
"symfony/polyfill-mbstring": "~1.0",
"symfony/translation-contracts": "^1.1.6|^2"
},
"conflict": {
"symfony/config": "<3.4",
"symfony/dependency-injection": "<3.4",
"symfony/http-kernel": "<4.4",
"symfony/yaml": "<3.4"
},
"provide": {
"symfony/translation-implementation": "1.0"
},
"require-dev": {
"psr/log": "~1.0",
"symfony/config": "^3.4|^4.0|^5.0",
"symfony/console": "^3.4|^4.0|^5.0",
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
"symfony/finder": "~2.8|~3.0|~4.0|^5.0",
"symfony/http-kernel": "^4.4",
"symfony/intl": "^3.4|^4.0|^5.0",
"symfony/service-contracts": "^1.1.2|^2",
"symfony/yaml": "^3.4|^4.0|^5.0"
},
"suggest": {
"psr/log-implementation": "To use logging capability in translator",
"symfony/config": "",
"symfony/yaml": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.4-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\Translation\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
"time": "2020-02-04T09:32:40+00:00"
},
{
"name": "symfony/translation-contracts",
"version": "v2.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation-contracts.git",
"reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation-contracts/zipball/8cc682ac458d75557203b2f2f14b0b92e1c744ed",
"reference": "8cc682ac458d75557203b2f2f14b0b92e1c744ed",
"shasum": ""
},
"require": {
"php": "^7.2.5"
},
"suggest": {
"symfony/translation-implementation": ""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Contracts\\Translation\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Generic abstractions related to translation",
"homepage": "https://symfony.com",
"keywords": [
"abstractions",
"contracts",
"decoupling",
"interfaces",
"interoperability",
"standards"
],
"time": "2019-11-18T17:27:11+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.0"
},
"platform-dev": []
}
\ No newline at end of file
<?php
// Import de la class qui a pour but de charger tous les imports du projet
require_once './vendor/autoload.php';
// Liste des tous les imports
use bdd\controllers\ControleurRequete;
use \bdd\views\AccueilView;
use \Illuminate\Database\Capsule\Manager as DB;
use \Slim\Slim;
// instance de la base de données
$db = new DB();
// ajout des informations pour se connecter à la base de données
$db->addConnection(parse_ini_file('conf/conf.ini'));
// demarage de la basse de donnée
$db->setAsGlobal();
$db->bootEloquent();
// demerage d'un session
session_start();
// intance de slim qui a pour but de créer le rootage des urls
$app = new Slim();
/*-----|accueil|-----*/
$app->get('/', function () {
$v = new AccueilView();
$v->render();
})->name('accueil');
$app->get('/tp2req1', function () {
$v = new ControleurRequete();
$v->selectChar();
})->name('tp2req1');
$app->get('/tp2req2', function () {
$v = new ControleurRequete();
$v->selectCharMario();
})->name('tp2req2');
$app->get('/tp2req3', function () {
$v = new ControleurRequete();
$v->gameCompanySony();
})->name('tp2req3');
$app->get('/gameNumber', function () {
$v = new ControleurRequete();
$v->selectGameNumber();
})->name('gameNumber');
$app->get('/page/:p', function ($p) {
$v = new ControleurRequete();
$v->selectPage($p);
})->name('page');
$app->run();
\ No newline at end of file
<?php
namespace bdd\controllers;
use bdd\models\Company;
use bdd\models\Game;
use bdd\models\Platform;
use bdd\models\Character;
use bdd\models\Game2character;
use bdd\models\Game_publisher;
use bdd\views\RequeteView;
class ControleurRequete{
public function selectGame(){
$jeu = Game::select('name')->get();
$vue = new RequeteView($jeu);
$vue->render(1);
}
public function selectMario(){
$jeu = Game::select('name')->where('name','like','%Mario%','or','alias','like','%Mario%')->get();
$vue = new RequeteView($jeu);
$vue->render(1);
}
public function selectCharMario(){
$data = Character::join('game2character','perso.id','=','game2character.character_id')
->join('game','game2character.game_id','=','game.id')
->select('id')
->where('game.name','LIKE','Mario%');
$vue = new RequeteView($data);
$vue->render(1);
}
public function selectCharFirstAppearedMario(){
$data = Character::join('game','perso.first_appeared_in_game_id','=','game.id')
->select('name')
->where('game.name','LIKE','Mario%');
$vue = new RequeteView($data);
$vue->render(1);
}
public function selectGameMarioAndRatingPlus3(){
$data = Game::join('game2rating','game_id','=','game2rating.rating_id')
->join('Rating','game2rating.rating_id','=','rating.id')
->select('name')
->where('game.name','LIKE','Mario%', 'AND', 'game_rating.name' 'LIKE', '%3+%');
$vue = new RequeteView($data);
$vue->render(1);
}
public function selectCharGame12342(){
$data = Character::join('game2character','perso.id','=','game2character.character_id')
->select('name')
->where('game2character.game_id','=','12342');
$vue = new RequeteView($data);
$vue->render(1);
}
public function gameCompanySony(){
$data = Game::join('game_publisher','game.id','=','game_publisher.game_id')
->join('company','game_publisher.comp_id','=','company.id')
->select('id')
->where('company.name','LIKE','%Sony%');
$vue = new RequeteView($data);
$vue->render(1);
}
}
\ No newline at end of file
<?php
namespace bdd\models;
class Character extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'character';
protected $primaryKey = 'id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\character', 'id');
}
}
\ No newline at end of file
<?php
namespace bdd\models;
class Company extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'company';
protected $primaryKey = 'id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\company', 'id');
}
}
\ No newline at end of file
<?php
namespace bdd\models;
class Game extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'game';
protected $primaryKey = 'id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\game', 'id');
}
}
\ No newline at end of file
<?php
namespace bdd\models;
class Game2character extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'Game2character';
protected $primaryKey = 'game_id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\Game2character', 'game_id');
}
}
\ No newline at end of file
<?php
namespace bdd\models;
class Game_publisher extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'game_publisher';
protected $primaryKey = 'game_id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\game_publisher', 'game_id');
}
}
\ No newline at end of file
<?php
namespace bdd\models;
class Platform extends \Illuminate\Database\Eloquent\Model
{
protected $table = 'platform';
protected $primaryKey = 'id';
public $timestamps = false;
public function platform(){
return $this->belongsTo('bdd\models\platform', 'id');
}
}
\ No newline at end of file
<?php
namespace bdd\views;
use Slim\Slim;
class AccueilView
{
protected $app;
public function __construct()
{
$this->app = Slim::getInstance();
}
public function render()
{
$baseURL = $_SERVER['REQUEST_URI'];
$url1 = $this->app->urlFor("tp2req1");
$url2 = $this->app->urlFor("tp2req2");
$url3 = $this->app->urlFor("tp2req3");
$url4 = $this->app->urlFor("gameNumber");
$url5 = $baseURL . "page/1";
$html = <<<HTML
<h1>Page d'accueil</h1>
<p>
lien:<br>
<a href=$url1>$url1</a><br>
<a href=$url2>$url2</a><br>
<a href=$url3>$url3</a><br>
<a href=$url4>$url4</a><br>
<a href=$url5>$url5</a><br>
</p>
HTML;
echo $html;
}
}
<?php
namespace bdd\views;
use Slim\Slim;
class RequeteView
{
protected $tab, $app;
public function __construct($t)
{
$this->tab = $t;
$this->app = Slim::getInstance();
}
public function render($type)
{
$html = "";
switch ($type) {
case 1:
$html = $this->default();
break;
default:
$html = $this->notFound();
break;
}
echo $html;
}
private function notFound()
{
return <<<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<br>
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