public static function nbreEtudiantByFiliere($id) { $filiere = Filiere::find($id); $i = 0; if ($filiere != null) { $promos = $filiere->promos; if (count($promos) > 0) { foreach ($promos as $promo) { if (count($promo->etudiants) > 0) { $i = $i + count($promo->etudiants); } } } } return $i; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $filiere = Filiere::find($id); $filiere->delete(); return redirect('/app/filieres'); }