<?php namespace App\Http\Controllers;

use Auth\AuthController;
use App\User;
use App\Models\Niveau;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Redirect;
use View;
use App\Http\Requests\NiveauRequest;


class NiveauxController extends Controller {

    private $menu='niveaux';
    private $submenu='';
    private $title='Niveaux';

    public function index()
    {
        if(!($user=Auth::user())) return Redirect::route( 'login' );
        if(!$user->hasRole('ADMINISTRATEUR')) if(!$user->can("consulter niveaux")) return Redirect::route('home');

        $niveaux = Niveau::all();

        return View::make('niveaux.index', [
            'user' => $user,'menu' => $this->menu,'submenu' => $this->submenu,'title' => $this->title,
            'niveaux' => $niveaux,
        ]);
    }

    public function create()
    {

    }

    public function store(NiveauRequest $request)
    {

    }
 
    public function edit($id,$mode="edit")
    {

    }
 
    public function update($id,NiveauRequest $request)
    {

    }
 
    public function show($id)
    {

    }

    public function destroy($id)
    {

    }


    public function setData($request,$id="")
    {

    }
}