0% found this document useful (0 votes)
25 views5 pages

Exemples Reherche Laravel

The document describes a student management system built with Laravel. It includes a master layout blade template that yields content, a form to filter students by major, a controller to get students and filter by major, and routes to load the index and filter.

Uploaded by

ahmed.douyry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views5 pages

Exemples Reherche Laravel

The document describes a student management system built with Laravel. It includes a master layout blade template that yields content, a form to filter students by major, a controller to get students and filter by major, and routes to load the index and filter.

Uploaded by

ahmed.douyry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Exemples Reherche Laravel

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="{{asset('style.css')}}">
</head>
<body>
<header>
<h1>Gestion des étudiants</h1>
</header>
<hr>
<nav>
<ul>
<li><a href="#">Liste des étudiants</a> </li>
<li><a href="#">Ajouter un étudiant</a> </li>
</ul>
</nav>
<hr>
<main>
@yield('content')
</main>
</body>
</html>
@extends('master')
@section('content')
<form action="{{route('filter')}}" method="get">
<div>
Choisir filière
</div>
<div>
<select name="id_filiere" id="">
@foreach($filieres as $filiere)
<option value="{{$filiere->id_filiere}}">{{$filiere-
>libelle}}</option>
@endforeach
</select>
<button>Filtrer</button>
</div>
</form>
<table border='1' width='100%'>
<tr>
<th>Numéro</th>
<th>Nom</th>
<th>Prénom</th>
<th>Date naissance</th>
<th>Email</th>
<th>Filière</th>
</tr>
@foreach($etudiants as $etudiant)
<tr>
<td>{{$etudiant->numero}}</td>
<td>{{$etudiant->nom}}</td>
<td>{{$etudiant->prenom}}</td>
<td>{{$etudiant->date_naiss}}</td>
<td>{{$etudiant->email}}</td>
<td>{{$etudiant->id_filiere}}</td>
</tr>
@endforeach
</table>

@stop

<?php

namespace App\Http\Controllers;

use App\Models\Etudiant;
use App\Models\Filiere;
use Illuminate\Http\Request;

class EtudiantController extends Controller


{
public function index(){
$filieres=Filiere::all();
$etudiants=Etudiant::all();
return view("index",compact("filieres"),compact("etudiants"));
}
public function filter(Request $request){
$filieres=Filiere::all();
$etudiants=Etudiant::where('id_filiere','=',$request->id_filiere)->get();
return view("index",compact("filieres"),compact("etudiants"));
}
}

<?php

use App\Http\Controllers\EtudiantController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', [EtudiantController::class,'index'])->name('index');
Route::get('/filter', [EtudiantController::class,'filter'])->name('filter');

You might also like