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/ReferentController.php
Malibu c0feb36014 modified: app/Http/Controllers/ReferentController.php
modified:   app/ListeOeuvre.php
	modified:   app/Oeuvre.php
	modified:   resources/views/referent.blade.php
2015-02-19 00:15:29 +01:00

123 lines
2.3 KiB
PHP
Executable File

<?php namespace App\Http\Controllers;
use App\User;
use Input;
use Request;
use App\ListeOeuvre;
use App\AssoListeAOeuvre;
class ReferentController extends Controller {
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
$me = User::current();
$user = User::all();
// $ListeOeuvre = new ListeOeuvre;
// $ListeOeuvre->iduser = 3;
// $ListeOeuvre->nom = "Linux";
// $ListeOeuvre->etat = 1;
// $ListeOeuvre->save();
// $assolistaoeuvre = new AssoListeAOeuvre;
// $assolistaoeuvre->liste_oeuvre_id = 1;
// $assolistaoeuvre->oeuvre_id = 1;
// $assolistaoeuvre->save();
// $assolistaoeuvre2 = new AssoListeAOeuvre;
// $assolistaoeuvre2->liste_oeuvre_id = 1;
// $assolistaoeuvre2->oeuvre_id = 2;
// $assolistaoeuvre2->save();
// List Oeuvre of one user
$sessions = ListeOeuvre::currentUser()->get();
//echo $sessions[0]->oeuvres()->get();
return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'sessions' => $sessions]);
}
/**
* updateUser an user informations in database.
*
*
*/
public function update()
{
$idUser = Input::get('idUser');
$user = User::find($idUser);
if (Request::hasFile('file'))
{
Request::file('file')->move("./pictures/user_picture/", $idUser);
$user->image = "pictures/user_picture/".$idUser;
}
$user->firstname = Input::get('firstname');
$user->email = Input::get('email');
$user->city = Input::get('city');
$user->lastname = Input::get('lastname');
$user->save();
return redirect('/referent')->with('message_update', 'Referent mis à jour avec succès');
}
/**
* create a new session
*
*/
public function addSession()
{
// TODO
$ListeOeuvre = new ListeOeuvre;
$ListeOeuvre->iduser = 2;
$ListeOeuvre->nom = "Linux";
$ListeOeuvre->etat = 1;
$ListeOeuvre->save();
$assolistaoeuvre = new AssoListeAOeuvre;
$assolistaoeuvre->liste_oeuvre_id = 1;
$assolistaoeuvre->oeuvre_id = 1;
$assolistaoeuvre->save();
$assolistaoeuvre2 = new AssoListeAOeuvre;
$assolistaoeuvre2->liste_oeuvre_id = 1;
$assolistaoeuvre2->oeuvre_id = 2;
$assolistaoeuvre2->save();
}
/**
* get all user sessions
*
*/
private function getSessions()
{
// TODO
}
}