/**
  * Affiche le formulaire pour modifier une commande.
  * nombreProduits sert à la fonction update comme compteur de ligne
  *
  * @param  int  $id (L'id de la commande a modifiée)
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     try {
         $user = Auth::user();
         $role = $user->role;
         $clients = Client::lists('id');
         $commande = Commande::findOrFail($id);
         $produitsFinis = $commande->ProduitsFinis()->orderby("code")->get();
         $nombreProduits = count($produitsFinis);
         $data = array();
         $i = 1;
         /**
          * Assigne les "name" de chaque informations dans chacun des produits attachés à la commande.
          */
         foreach ($produitsFinis as $produit) {
             $row = array();
             array_push($row, $i . '_code');
             array_push($row, $produit->code);
             array_push($row, $i . '_pointure');
             array_push($row, $produit->pivot->pointure);
             array_push($row, $i . '_quantite');
             array_push($row, $produit->pivot->quantite);
             array_push($data, $row);
             $i = $i + 1;
         }
     } catch (ModelNotFoundException $e) {
         App::abort(404);
     }
     return View::make('commandes.edit', compact('commande', 'role', 'clients', 'data', 'nombreProduits'));
 }