This repository has been archived on 2021-09-15. You can view files and clone it, but cannot push or open issues or pull requests.
ModuleWeb/SRC/app/Http/Controllers/HomeController.php

70 lines
1.4 KiB
PHP
Raw Normal View History

2015-02-12 12:56:47 +00:00
<?php namespace App\Http\Controllers;
2015-03-10 15:12:02 +00:00
use App\Referent;
2015-03-16 18:47:57 +00:00
use Cookie;
2015-02-12 12:56:47 +00:00
class HomeController extends Controller {
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
2015-03-10 14:57:41 +00:00
//
2015-02-12 12:56:47 +00:00
}
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
2015-02-12 12:56:47 +00:00
{
2015-03-16 18:47:57 +00:00
$idRef = Cookie::get('referent');
$ref = Referent::find($idRef);
return view('frontend/games', ['ref' => $ref]);
}
public function choisirRef()
{
return view('frontend/home',['referents' => Referent::get()]);
}
public function changerRef($idRef)
{
if(Referent::find($idRef)) {
$response = new \Illuminate\Http\RedirectResponse(url('/'));
$response->withCookie(cookie()->forever('referent', $idRef));
return $response;
} else return $this->choisirRef();
2015-02-12 12:56:47 +00:00
}
2015-03-10 14:57:41 +00:00
/**
* Show referent games
*
* @param String $id
* @return Response
*/
public function showReferentGames($id)
{
return view('referent_games', ['referent' => $id]);
}
/**
* Show one referent game
*
* @param String $id
* @param String $idGame
* @return Response
*/
public function showOneReferentGame($id, $idGame)
{
return view('one_referent_game', ['referent' => $id, 'game' => $idGame]);
}
2015-02-12 12:56:47 +00:00
}
?>