Laravel
Models Migration Relation
Introduction Installation Projet:Structure Strucutre,model,migration Migration,Models,Relation Artisan CLI Migrations:Exemples Models:Exemples Relations:Exemples 1 Relations:Exemples 2
Les Relations
BelongsTo HasOne HasMany BelongsToMany HasManyThrough
Exemples des Relations
Relations:oneToMany,ManyToMany... Relations:Exemples
Exercices
Exercice 1 Exercice 2
Controllers Views Routes
Routes,Controller,Model,view
Les Routes
Définir:Routes Routes avec Paramètres Routes nommées Groupes de routes
Les Controllers
Les Controllers Les Contrôleurs de Ressources
Les Vues
Vues et Blade Templates Blade Layouts et Sections Sous-vues Composants et Slots Contrôles de flux
MVC :CRUD
CRUD: Produit CRUD: Etudiant CRUD: Car CRUD,Recherche: Book
Validation
Exemple :Projets
ORM:Eloquent
Exemple :Transport
Api:Laravel +React
Middleware

Seeders & Factories
Exemples :EFM

Authenfication
TP:Schools Management
Authenfication:React
Layouts
Exercices





Projet:Backend (Laravel)

Projet gestion de l'école ( EduManage ) réalisé par :AIT-TALB Younes

Le code source est disponible sur github : EduManage

Description du projet

  • Fonctionnalités :

    Authentification :

    • Les utilisateurs peuvent s'inscrire et se connecter avec différents rôles : étudiant, professeur, directeur ou superadministrateur.

    Gestion des utilisateurs :

    • Le superadministrateur peut activer et désactiver les directeurs, ainsi que les supprimer. Il peut également ajouter de nouvelles écoles et afficher la liste des directeurs et des écoles.
    • Le directeur activé peut activer et désactiver les professeurs et les étudiants, ainsi que les supprimer. Il peut également gérer les groupes, les modules et les options de son école.
    • Les professeurs activés peuvent gérer les examens, y compris les lister, les ajouter, les mettre à jour et les supprimer.

    Gestion des profils :

    • Tous les utilisateurs peuvent mettre à jour leurs détails de profil et se déconnecter.

Tables

roles("idRole", "name")
schools("id", "name", "picture", "address")
users("id", "firstName", "lastName", "email", "password", "picture", "active", "school_id", "idRole")
groups("id", "name", "description", "school_id")
students("id", "CNE", "user_id", "group_id")
options("id", "school_id", "name")
modules("id", "name", "numberOfHours", "group_id", "option_id")
exams("id", "name", "mark", "module_id", "student_id")

Les pages :

Login page

Login page

Register page

Login page

System Admin home page

Login page

directeur home page

Login page

Professeur home page

Login page

Etudiant home page

Login page

Migrations

php artisan make:migration create_roles_table

<?php
    use Illuminate\Database\Migrations\Migration;
    use Illuminate\Database\Schema\Blueprint;
    use Illuminate\Support\Facades\Schema;
    
    return new class extends Migration
    {
        /**
         * Run the migrations.
         */
        public function up(): void
        {
            Schema::create('roles', function (Blueprint $table) {
                $table->id('idRole');
                $table->string('name');
                $table->timestamps();
            });
        }
    
        /**
         * Reverse the migrations.
         */
        public function down(): void
        {
            Schema::dropIfExists('roles');
        }
    };
    

php artisan make:migration create_schools_table

<?php
    
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('schools', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('picture');
            $table->string('address');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('schools');
    }
};
    

create_users_table.php
( existe déjà dans le fichier de migration vous n'êtes pas obligé de le créer il suffit de mettre à jour la fonction up)

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
    Schema::create('users', function (Blueprint $table) {
        $table->id();
        $table->string('firstName');
        $table->string('lastName');
        $table->string('email')->unique();
        $table->string('picture');
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->integer('active')->default(0);
        $table->unsignedBigInteger('school_id'); 
        $table->foreign('school_id')->references('id')->on('schools');
        $table->unsignedBigInteger('idRole');
        $table->foreign('idRole')->references('idRole')->on('roles');
        $table->rememberToken();
        $table->timestamps();
    });
    }

    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};

php artisan make:migration create_groups_table

<?php

    use Illuminate\Database\Migrations\Migration;
    use Illuminate\Database\Schema\Blueprint;
    use Illuminate\Support\Facades\Schema;
    
    return new class extends Migration
    {
        /**
         * Run the migrations.
         */
        public function up(): void
        {
            Schema::create('groups', function (Blueprint $table) {
                $table->id();
                $table->string('name');
                $table->string('description');
                $table->unsignedBigInteger('school_id');
                $table->foreign('school_id')->references('id')->on('schools');
                $table->timestamps();
            });
        }
    
        /**
         * Reverse the migrations.
         */
        public function down(): void
        {
            Schema::dropIfExists('groups');
        }
    };
    

php artisan make:migration create_students_table

<?php

    use Illuminate\Database\Migrations\Migration;
    use Illuminate\Database\Schema\Blueprint;
    use Illuminate\Support\Facades\Schema;
    
    return new class extends Migration
    {
        /**
         * Run the migrations.
         */
        public function up(): void
        {
            Schema::create('students', function (Blueprint $table) {
                $table->id();
                $table->string('CNE');
                $table->unsignedBigInteger('user_id');
                $table->unsignedBigInteger('group_id');
                $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
                $table->foreign('group_id')->references('id')->on('groups')->onDelete('cascade');
                $table->timestamps();
            });
        }
    
        /**
         * Reverse the migrations.
         */
        public function down(): void
        {
            Schema::dropIfExists('students');
        }
    };

php artisan make:migration create_options_table

<?php

    use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('options', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->unsignedBigInteger('school_id');
            $table->foreign('school_id')->references('id')->on('schools')->onDelete('cascade')->onUpdate('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('options');
    }
};

php artisan make:migration create_modules_table

<?php

    
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('modules', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('numberOfHours');
            $table->unsignedBigInteger('group_id');
            $table->unsignedBigInteger('option_id');
            $table->foreign('group_id')->references('id')->on('groups')->onDelete('cascade');
            $table->foreign('option_id')->references('id')->on('options')->onDelete('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('modules');
    }
};

php artisan make:migration create_exams_table

<?php

    use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('exams', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->decimal('mark');
            $table->unsignedBigInteger('student_id');
            $table->foreign('student_id')->references('id')->on('students')->onDelete('cascade');
            $table->unsignedBigInteger('module_id')
            $table->foreign('module_id')->references('id')->on('modules')->onDelete('cascade')->onUpdate('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('exams');
    }
};

Models :

php artisan make:model Role

<?php
    namespace App\Models;

    use Illuminate\Database\Eloquent\Factories\HasFactory;
    use Illuminate\Database\Eloquent\Model;
    
    class Role extends Model
    {
        use HasFactory;
    
        protected $primaryKey = 'id';
        protected $table = 'roles';
        protected $fillable = ['name'];
    
        public function users () {
            return $this->hasMany(User::class,'idRole');
        }
    }
    

php artisan make:model School

<?php
    namespace App\Models;

    use Illuminate\Database\Eloquent\Factories\HasFactory;
    use Illuminate\Database\Eloquent\Model;
    
    class School extends Model
    {
        use HasFactory;
    
        protected $primaryKey = 'id';
        protected $table = 'schools';
        protected $fillable = ['name', 'picture', 'address'];
    
        public function users()
        {
            return $this->hasMany(User::class);
        }
    
        public function directors()
        {
            return $this->users()->where('idRole', 1); 
        }
    
        public function group() {
            return $this->hasMany(Group::class);
        }
    
        public function option () {
            return $this->hasMany(Option::class);
        }
    
        
    }
    

User
(Le modèle utilisateur est déjà créé dans le dossier models, vous n'avez pas besoin de le créer, il suffit de mettre à jour le contenu)

<?php
    namespace App\Models;

    // use Illuminate\Contracts\Auth\MustVerifyEmail;
    use Illuminate\Database\Eloquent\Factories\HasFactory;
    use Illuminate\Foundation\Auth\User as Authenticatable;
    use Illuminate\Notifications\Notifiable;
    
    
    class User extends Authenticatable
    {
        use HasFactory, Notifiable;
    
        /**
         * The attributes that are mass assignable.
         *
         * @var array
         */
        protected $fillable = [
            'firstName',
            'lastName',
            'email',
            'picture',
            'password',
            'idRole',
            'school_id',
            'active',
    
        ];
    
        /**
         * The attributes that should be hidden for serialization.
         *
         * @var array
         */
        protected $hidden = [
            'password',
            'remember_token',
        ];
    
        /**
         * Get the attributes that should be cast.
         *
         * @return array
         */
        protected function casts(): array
        {
            return [
                'email_verified_at' => 'datetime',
                'password' => 'hashed',
            ];
        }
    
        public function student()
    {
        return $this->hasOne(Student::class, 'user_id', 'id');
    }
        public function role () {
            return $this->belongsTo(Role::class, 'idRole','idRole');
        }
    
        public function school()
        {
            return $this->belongsTo(School::class);
        }
    
        
    }

php artisan make:model Group

<?php
    namespace App\Models;

    use Illuminate\Database\Eloquent\Factories\HasFactory;
    use Illuminate\Database\Eloquent\Model;
    
    class Group extends Model
    {
        use HasFactory;
    
        protected $table = 'groups';
        protected $primaryKey = 'id';
        protected $fillable = ['name', 'description', 'school_id'];
    
        public function student () {
            return $this->hasMany(Student::class);
        }
    
        public function module () {
            return $this->hasMany(Module::class);
        }
    
        public function school () {
            return $this->belongsTo(School::class);
        }
    
    }
    

php artisan make:model Student

<?php
    namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Student extends Model
{
    use HasFactory;

    protected $primaryKey = 'id';
    protected $table = 'students';
    protected $fillable = ['user_id','CNE', 'group_id'];

    
    public function user () {
        return $this->belongsTo(User::class);
    }

    public function exam () {
        return $this->hasMany(Exam::class);
    }

    public function group() {
        return $this->belongsTo(Group::class);
    }   
}
    

php artisan make:model Option

<?php
    namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Option extends Model
{
    use HasFactory;
    protected $table = 'options';
    protected $primaryKey = 'id';
    protected $fillable = ['name', 'school_id'];

    public function module () {
        return $this->hasMany(Module::class);
    }

    public function school () {
        return $this->belongsTo(School::class);
    }
}

    

php artisan make:model Module

<?php
    namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Module extends Model
{
    use HasFactory;

    protected $table = 'modules';
    protected $primaryKey = 'id';
    protected $fillable = [
        'name', 'numberOfHours', 'group_id', 'option_id'
    ];

    public function group () {
        return $this->belongsTo(Group::class);
    }

    public function option () {
        return $this->belongsTo(Option::class);
    }

    public function exam () {
        return $this->hasMany(Exam::class);
    }
}

php artisan make:model Exam

<?php
    namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Exam extends Model
{
    use HasFactory;
    
    protected $table = 'exams';
    protected $primaryKey = 'id';
    protected $fillable = [
        'name', 'mark' , 'student_id' , 'module_id'
    ];
    

    public function student() {
        return $this->belongsTo(Student::class);
    }

    public function module () {
        return $this->belongsTo(Module::class);
    }
}

    

Controllers :

Auth/RegisterController.php

<?php
    namespace App\Http\Controllers\Auth;

    use App\Http\Controllers\Controller;
    use App\Models\Group;
    use App\Models\Role;
    use App\Models\Student;
    use App\Models\User;
    use App\Models\School;
    use Illuminate\Foundation\Auth\RegistersUsers;
    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Hash;
    use Illuminate\Support\Facades\Validator;
    
    class RegisterController extends Controller
    {
        use RegistersUsers;
    
        
    
        /**
         * Where to redirect users after registration.
         *
         * @var string
         */
        protected $redirectTo = '/home';
    
        /**
         * Create a new controller instance.
         *
         * @return void
         */
        public function __construct()
        {
            $this->middleware('guest');
        }
    
        public function showRegister()
        {
            $rolesList = Role::all();
            $schoolsList = School::all();
            $groupsList = Group::all();
            return view('auth.register', ['rolesList' => $rolesList, 'schoolsList' => $schoolsList, 'groupsList' => $groupsList]);
        }
    
        /**
         * Get a validator for an incoming registration request.
         *
         * @param  array  $data
         * @return \Illuminate\Contracts\Validation\Validator
         */
        protected function validator(array $data)
        {
            return Validator::make($data, [
                'firstName' => ['required', 'string', 'max:255'],
                'lastName' => ['required', 'string', 'max:255'],
                'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
                'password' => ['required', 'string', 'min:8', 'confirmed'],
                'idRole' => ['required', 'string', 'nullable'],
                'school_id' => ['required'],
                'profilePicture' => ['required', 'image', 'mimes:jpg,jpeg,png', 'max:5120'],
                'CNE' => ['required_if:idRole,3', 'string', 'nullable'],
                'group_id' => ['required_if:idRole,3', 'string', 'nullable'],
            ]);
        }
    
        /**
         * Handle the profile picture upload.
         *
         * @param  \Illuminate\Http\UploadedFile  $file
         * @return string
         */
        protected function handleUploadPicture($file)
        {
            $folder = 'pictures';
            $token = uniqid();
            $pictureSrc = $folder . '/' . $token . '-' . $file->getClientOriginalName();
            $file->move(public_path($folder), $token . '-' . $file->getClientOriginalName());
    
            return $pictureSrc;
        }
    
        /**
         * Create a new user instance after a valid registration.
         *
         * @param  array  $data
         * @return \App\Models\User
         */
        protected function create(array $data)
        {
            $profilePictureSrc = $this->handleUploadPicture(request()->file('profilePicture'));
            $role = Role::where('idRole', $data['idRole'])->firstOrFail();
            
            $user = User::create([
                'firstName' => $data['firstName'],
                'lastName' => $data['lastName'],
                'email' => $data['email'],
                'idRole' => $data['idRole'],
                'password' => Hash::make($data['password']),
                'picture' => $profilePictureSrc,
                'active' => 0,
                'school_id' => $data['school_id']
            ]);
            if ($role->name === 'Student') {
                Student::create([
                    'user_id' => $user->id,
                    'CNE' => $data['CNE'],
                    'group_id' => $data['group_id'],
                ]);
            }
    
            return $user;
        }
    }
    

Auth/LoginController.php

<?php
    namespace App\Http\Controllers\Auth;

    use App\Http\Controllers\Controller;
    use Illuminate\Foundation\Auth\AuthenticatesUsers;
    
    class LoginController extends Controller
    {
      
    
        use AuthenticatesUsers;
    
        /**
         * Where to redirect users after login.
         *
         * @var string
         */
        protected $redirectTo = '/home';
    
        /**
         * Create a new controller instance.
         *
         * @return void
         */
        public function __construct()
        {
            $this->middleware('guest')->except('logout');
        }
    }
    

php artisan make:controller UserController

permet aux utilisateurs de mettre à jour les détails de leur profil et permet à l'administrateur d'activer et de désactiver les directeurs et également de les supprimer

<?php
    namespace App\Http\Controllers;
    
    use App\Models\Role;
    use App\Models\Student;
    use App\Models\User;
    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Hash;
    use Illuminate\Validation\Rule;
    use Illuminate\Support\Facades\Auth;
    
    
    class UserController extends Controller
    {
        protected function handleUploadPicture($file)
        {
            $folder = 'pictures';
            $token = uniqid();
            $pictureSrc = $folder . '/' . $token . '-' . $file->getClientOriginalName();
            $file->move(public_path($folder), $token . '-' . $file->getClientOriginalName());
    
            return $pictureSrc;
        }
        
        public function deactivateDirector($id)
        {
            $director = User::find($id);
            $director->active = 0;
            $director->save();
            return redirect()->back()->with('success', 'Director desactivated successfully');
        
        }
    
        public function activateDirector($id)
        {
            $director = User::find($id);
            $director->active = 1;
            $director->save();
            return redirect()->back()->with('success', 'Director activated successfully');
        
        }
    
        public function destroy(User $user, Student $student = null) 
        {
            $currentUser = Auth::user();
            if($currentUser->role->name === "Student"){
                $student->delete();
                return redirect()->back()->with('success', 'User deleted successfully');
            }else {
                $user->delete();
            }
    
            return redirect()->back()->with('success', 'User deleted successfully');
        }
    
        public function modifyUser(User $user) 
        {
            return view('user.update', compact('user'));
        }
    
        public function update(Request $request, User $user)
        {
            $validatedData = $request->validate([
                'firstName' => ['string', 'max:255'],
                'lastName' => ['string', 'max:255'],
                'email' => ['string', 'email', 'max:255', Rule::unique('users')->ignore($user->id)],
                'password' => ['string', 'min:8', 'nullable'],
                'idRole' => ['string', 'max:255', 'exists:roles,idRole'],
                'profilePicture' => ['nullable', 'image', 'mimes:jpg,jpeg,png', 'max:5120'],
                'CNE' => ['required_if:idRole,Student', 'string', 'nullable']
            ]);
    
            if ($request->hasFile('profilePicture')) {
                $validatedData['profilePicture'] = $this->handleUploadPicture($request->file('profilePicture'));
                $user->picture = $validatedData['profilePicture'];
                $user->save();
            }
    
            if (empty($validatedData['password'])) {
                unset($validatedData['password']);
            } else {
                $validatedData['password'] = Hash::make($validatedData['password']);
            }
    
            $user->update($validatedData);
    
            if ($request->idRole === 'Student') {
                if ($user->student) {
                    $user->student->update(['CNE' => $validatedData['CNE']]);
                } else {
                    Student::create(['user_id' => $user->id, 'CNE' => $validatedData['CNE']]);
                }
            }
    
            return redirect()->route('home')->with('success', 'User details updated successfully');
        }
    
        
    }
    

Mettre à jour les informations

profile

Activer, Desactiver, Supprimer directeur

directors

php artisan make:controller DirectorController

permet aux directeurs de voir la liste des professeurs et la liste des étudiants dans leur annonce scolaire et d'activer et de désactiver l'étudiant ou le professeur

<?php
    namespace App\Http\Controllers;

    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Auth;
    use App\Models\User;
    
    
    
    class DirectorController extends Controller
    {
        public function showDirectorsList() 
        {
            if (Auth::user()->role->name === "sysAdmin") {
                $directeursList = User::join('roles', 'users.idRole', '=', 'roles.idRole')
                    ->where('roles.name', 'Director')
                    ->get();
                return view("admin.directeursList", compact('directeursList'));
            } else {
                return redirect("/home");
            }
        }
    
        public function showProfessorsList()
        {
            if (Auth::user()->role->name === "Director") {
                $directorSchoolId = Auth::user()->school_id;
    
                $professorsList = User::select('users.id', 'users.firstName', 'users.lastName', 'users.email', 'users.active', 'schools.name as school_name', 'roles.name as role_name')
                                    ->join('roles', 'users.idRole', '=', 'roles.idRole')
                                    ->join('schools', 'users.school_id', '=', 'schools.id')
                                    ->where('roles.name', 'Professor')
                                    ->where('schools.id', $directorSchoolId)
                                    ->get();
                return view("professor.professorsList", compact('professorsList'));
            } else {
                return redirect("/home");
            }
        }
    
        
    
        public function showStudentsList () {
            if (Auth::user()->role->name === "Director") {
                $directorSchoolId = Auth::user()->school_id; 
                $studentsList = User::join('roles', 'users.idRole', '=', 'roles.idRole')
                                    ->join('schools', 'users.school_id', '=', 'schools.id')
                                    ->join('students', 'users.id', '=', 'students.user_id')
                                    ->where('roles.name', 'Student')
                                    ->where('schools.id', $directorSchoolId) 
                                    ->with('school', 'student')
                                    ->get();
                
                return view("student.studentsList", compact('studentsList'));
            } else {
                return redirect("/home");
            }
        }
    
        public function deactivateStudentOrProfessor($id)
        {
            $studentOrProfessor = User::find($id);
            if ($studentOrProfessor) {
                $studentOrProfessor->active = 0;
                $studentOrProfessor->save();
                return redirect()->back()->with('success', 'User deactivated successfully');
            }
            return redirect()->back()->with('error', 'User not found');
        }
    
        public function activateStudentOrProfessor($id)
        {
            $studentOrProfessor = User::find($id);
            if ($studentOrProfessor) {
                $studentOrProfessor->active = 1;
                $studentOrProfessor->save();
                return redirect()->back()->with('success', 'User activated successfully');
            }
            return redirect()->back()->with('error', 'User not found');
        }
    }

Lister, Activer, Desactiver, Professeur ou Etudiant

professeurs étudiants

php artisan make:controller GroupController

permet au directeur d'ajouter, de mettre à jour, de lister et de supprimer les groupes liés à son école

<?php
    namespace App\Http\Controllers;

    use App\Models\Group;
    use App\Models\School;
    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Auth;
    
    class GroupController extends Controller
    {
        public function showGroupsList () {
    
            $schoolId = Auth::user()->school_id;
    
            $groupsList = Group::where('school_id', $schoolId)->get();
            return view('group.groupsList', compact('groupsList'));
        }
    
        public function destroyGroup(Group $group) {
            $schoolId = Auth::user()->school_id;
            $userRole = Auth::user()->role->name;
        
            if ($userRole === 'Director' && Auth::user()->active === 1) { 
                if ($group->school_id == $schoolId) {
                    $group->delete();
                    return back()->with('success', 'Group deleted successfully');
                }
        
                return back()->with('error', 'You do not have permission to delete this group');
            }
        
            return back()->with('error', 'You do not have permission to delete this group');
        }
    
    
        public function createGroup () {
            return view('group.create');
        }
    
        public function storeGroup (Request $request) {
    
            $schoolId = Auth::user()->school_id;
    
    
            $validatedData = $request->validate([
                'name' => 'required|string|max:255',
                'description' => 'required|string',
            ]);
    
            Group::create([
                'name' => $validatedData['name'],
                'description' => $validatedData['description'],
                'school_id' => $schoolId,
            ]);
    
            return redirect()->route('director.showGroupsList')->with('success', 'Group created successfully');
        }
    
        public function editGroup (Group $group){
            return view('group.edit', compact('group'));
        }
    
        public function updategroup(Request $request, Group $group){
            $validatedData = $request->validate([
                'name' => 'required|string|max:255',
                'description' => 'required|string',
            ]);
    
            $group->update([
                'name' => $validatedData['name'],
                'description' => $validatedData['description']
            ]);
    
            return redirect()->route('director.showGroupsList')->with('success', 'Group updated successfully');
        }
    }

Lister les group

directors

Ajouter group

directors

Modifier group

directors

php artisan make:controller OptionController

permet au directeur d'ajouter, de mettre à jour, de lister et de supprimer les option liés à son école

<?php
    namespace App\Http\Controllers;

    use App\Models\Option;
    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Auth;
    use PhpParser\Node\Expr\FuncCall;
    
    class OptionController extends Controller
    {
       public function showOptionsList () {
            $schoolId = Auth::user()->school_id;
    
            $optionsList = Option::where('school_id', $schoolId)->get();
            return view('option.optionList', compact('optionsList'));
       }
    
       public function createOption () {
        return view('option.create');
       }
    
       public function storeOption (Request $request) {
        $schoolId = Auth::user()->school_id;
    
         $validatedData = $request->validate([
            'name' => 'required|string'
         ]);
    
         Option::create([
    
            'name'=>$validatedData['name'],
            'school_id' => $schoolId
         ]);
    
         return redirect()->route('director.showOptionsList')->with('success', 'Option created successfully');
    
       }
    
       public function editOption (Option $option) {
        return view('option.edit', compact('option'));
       }
    
        public function updateOption(Request $request, Option $option){
            $validatedData = $request->validate([
                'name' => 'required|string|max:255',
            ]);
    
            $option->update([
                'name' => $validatedData['name'],
            ]);
    
            return redirect()->route('director.showOptionsList')->with('success', 'Option updated successfully');
        }
    
        public function destroyOption(Option $option) {
            $schoolId = Auth::user()->school_id;
            $userRole = Auth::user()->role->name;
        
            if ($userRole === 'Director' && Auth::user()->active === 1) { 
                if ($option->school_id == $schoolId) {
                    $option->delete();
                    return back()->with('success', 'Option deleted successfully');
                }
        
                return back()->with('error', 'You do not have permission to delete this Option');
            }
        
            return back()->with('error', 'You do not have permission to delete this Option');
        }
    }
    

Liste des Options

directors

Ajouter Option

directors

Modifier Option

directors

php artisan make:controller ModuleController

permet au directeur d'ajouter, de mettre à jour, de lister et de supprimer les modules liés à son école

<?php
    namespace App\Http\Controllers;

use App\Models\Group;
use App\Models\Module;
use App\Models\Option;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class ModuleController extends Controller
{
    public function showModulesList () {
        $schoolId = Auth::user()->school_id;
        
        $optionID = Option::where('school_id', $schoolId)->value('id');
    
        $modulesList = Module::where('option_id', $optionID)->get();
    
        return view('module.modulesList', compact('modulesList'));
    }
    

    public function createModule () {
        $schoolId = Auth::user()->school_id;

        $optionsList = Option::where('school_id', $schoolId)->get();
        $groupsList = Group::where('school_id', $schoolId)->get();

        return view('module.create', ['optionsList'=>$optionsList, 'groupsList'=>$groupsList]);
    }

    public function storeModule (Request $request) {
        $validatedData = $request->validate([
            'name' => ['required', 'string'],
            'numberOfHours' => ['required', 'integer'],
            'option_id' => ['required', 'exists:options,id'],
            'group_id' => ['required', 'exists:groups,id']
        ]);
        
        
        Module::create([
            'name' =>$validatedData['name'],
            'numberOfHours' =>$validatedData['numberOfHours'],
            'option_id' => $validatedData['option_id'],
            'group_id' => $validatedData['group_id']

        ]);

        return redirect()->route('director.showModulesList')->with('success', 'Module created successfully');

    }

    public function editModule (Module $module) {
        $schoolId = Auth::user()->school_id;

        $optionsList = Option::where('school_id', $schoolId)->get();
        $groupsList = Group::where('school_id', $schoolId)->get();

        return view('module.edit', ['optionsList' => $optionsList, 'groupsList' => $groupsList, 'module' => $module]);
    }

    public function updateModule(Request $request, Module $module)
    {
        $validatedData = $request->validate([
            'name' => ['required', 'string'],
            'numberOfHours' => ['required', 'integer'],
            'option_id' => ['required', 'exists:options,id'],
            'group_id' => ['required', 'exists:groups,id']
        ]);

        $module->update($validatedData);

        return redirect()->route('director.showModulesList')->with('success', 'Module updated successfully');
    }

    public function destroyModule (Module $module) {
        $module->delete();
        return redirect()->route('director.showModulesList')->with('success', 'Module deleted successfully');

    }
}
    

Liste des Module

directors

Ajouter Module

directors

Modifier Module

directors

php artisan make:controller SchoolController

permet au System administrateur d'ajouter, de mettre à jour, de voir les details, de lister et de supprimer les Ecoles

<?php

    namespace App\Http\Controllers;

use App\Models\School;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class SchoolController extends Controller
{

  protected function handleUploadPicture($file)
  {
      $folder = 'pictures';
      $token = uniqid();
      $pictureSrc = $folder . '/' . $token . '-' . $file->getClientOriginalName();
      $file->move(public_path($folder), $token . '-' . $file->getClientOriginalName());

      return $pictureSrc;
  }

  public function showSchoolsList() 
  {
      if (Auth::user()->role->name === "sysAdmin") {
          $schoolsList = School::all();
          return view("admin.schoolsList", compact('schoolsList'));
      } else {
          return redirect("/home");
      }
  }

  public function destroySchool(School $school) 
  {
      $school->delete();

      return redirect()->back()->with('success', 'School deleted successfully');
  }

  public function createSchool() 
  {
      return view('school.create');
  }

  public function storeSchool(Request $request)
  {
      $validatedData = $request->validate([
          'schoolName' => ['required', 'string', 'max:255'],
          'schoolAddress' => ['required', 'string', 'max:255'],
          'schoolPicture' => ['required', 'image', 'mimes:jpg,jpeg,png', 'max:5120'],
      ]);

      $picturePath = $this->handleUploadPicture($request->file('schoolPicture'));

      School::create([
          'name' => $validatedData['schoolName'],
          'address' => $validatedData['schoolAddress'],
          'picture' => $picturePath,
      ]);

      return redirect()->route('admin.schoolsList')->with('success', 'School created successfully');
  }

  public function modifySchool(School $school) 
    {
        return view('school.update', compact('school'));
    }

  public function updateSchool(Request $request, School $school)
  {
      $validatedData = $request->validate([
          'schoolName' => ['required', 'string', 'max:255'],
          'schoolAddress' => ['required', 'string', 'max:255'],
          'schoolPicture' => ['nullable', 'image', 'mimes:jpg,jpeg,png', 'max:5120'],
      ]);

      if ($request->hasFile('schoolPicture')) {
          $validatedData['schoolPicture'] = $this->handleUploadPicture($request->file('schoolPicture'));
      } else {
          unset($validatedData['schoolPicture']);
      }

      $school->update([
          'name' => $validatedData['schoolName'],
          'address' => $validatedData['schoolAddress'],
          'picture' => $validatedData['schoolPicture'] ?? $school->picture,
      ]);

      return redirect()->route('admin.schoolsList')->with('success', 'School updated successfully');
  }

  public function schoolDetails(School $school)
  {
      $school->load('directors');
      return view('school.details', compact('school'));
  }


}   

Liste des Ecole

directors

Ajouter Ecole

directors

Modifier Ecole

directors

Details Ecole

directors

php artisan make:controller ExamController

permet au professeur d'ajouter, de mettre à jour, de lister et de supprimer les exam lié à son école

<?php
    namespace App\Http\Controllers;

use App\Models\Exam;
use App\Models\Group;
use App\Models\Module;
use App\Models\Student;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class ExamController extends Controller
{
    public function showExamsList() {
        $professorSchoolId = Auth::user()->school->id;
        $groupIds = Group::where('school_id', $professorSchoolId)->pluck('id');
        $moduleIds = Module::whereIn('group_id', $groupIds)->pluck('id');
        $exams = Exam::whereIn('module_id', $moduleIds)->with('student.user')->get();
        return view('exam.examsList', compact('exams'));
    }

    public function createExam () {
        $professorSchoolId = Auth::user()->school->id;
        $groups = Group::where('school_id', $professorSchoolId)->get();
        $modules = Module::whereIn('group_id', $groups->pluck('id'))->get();
        $students = Student::whereIn('group_id', $groups->pluck('id'))
                        ->with('user')
                        ->get();

        return view('exam.create', compact('modules', 'students'));
    }

    public function storeExam (Request $request){
        $validatedData = $request->validate([
            'name' => 'required|string|max:255',
            'mark' => 'required|numeric|min:0',
            'student_id' => 'required|exists:students,id',
            'module_id' => 'required|exists:modules,id',
        ]);

        Exam::create($validatedData);
        return redirect()->route('professor.showExamsList')->with('success', 'Exam created successfully');
    }

    public function editExam (Exam $exam) {
        $professorSchoolId = Auth::user()->school->id;
        $groups = Group::where('school_id', $professorSchoolId)->get();
        $modules = Module::whereIn('group_id', $groups->pluck('id'))->get();
        $students = Student::whereIn('group_id', $groups->pluck('id'))
                        ->with('user')
                        ->get();
        return view('exam.edit', compact('exam', 'modules', 'students'));
    }

    public function updateExam (Request $request, Exam $exam) {
        $validatedData = $request->validate([
            'name' => 'required|string|max:255',
            'mark' => 'required|numeric|min:0',
            'student_id' => 'required|exists:students,id',
            'module_id' => 'required|exists:modules,id',
        ]);

        $exam->update($validatedData);
        return redirect()->route('professor.showExamsList')->with('success', 'Exam updated successfully.');
    }

    public function destroyExam (Exam $exam){
        $exam->delete();
        return redirect()->route('professor.showExamsList')->with('success', 'Exam deleted successfully.');


    }   
}

Liste des Exam

directors

Ajouter Exam

directors

Modifier Exam

directors

Middlewares :

php artisan make:middleware AdminMiddleware

<?php
    namespace App\Http\Middleware;

    use Closure;
    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\Auth;
    use Symfony\Component\HttpFoundation\Response;
    
    class AdminMiddleware
    {
        /**
         * Handle an incoming request.
         *
         * @param  \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response)  $next
         */
        public function handle(Request $request, Closure $next): Response
    
        { 
            if (Auth::check() && Auth::user()->idRole === 4  && Auth::user()->active === 1) {
                return $next($request);
            }
    
            return redirect('/home');
        }
    }
    

php artisan make:middleware DirectorMiddleware

<?php
    
namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;

class DirectorMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response)  $next
     */
    public function handle(Request $request, Closure $next): Response
    {
        if (Auth::check() && Auth::user()->idRole === 1  && Auth::user()->active === 1) {
            return $next($request);
        }

        return redirect('/home');
    }
}
    

php artisan make:middleware ProfessorMidlleware

<?php
    
    namespace App\Http\Middleware;

    use Closure;
    use Illuminate\Http\Request;
    use Symfony\Component\HttpFoundation\Response;
    use Illuminate\Support\Facades\Auth;
    
    
    class ProfessorMiddleware
    {
        /**
         * Handle an incoming request.
         *
         * @param  \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response)  $next
         */
        public function handle(Request $request, Closure $next): Response
        {
            if (Auth::check() && Auth::user()->idRole === 2  && Auth::user()->active === 1) {
                return $next($request);
            }
    
            return redirect('/home');
        }
    }
        

Routes :

web.php

<?php
    use App\Http\Controllers\Auth\RegisterController;
    use App\Http\Controllers\UserController;
    use App\Http\Controllers\HomeController;
    use App\Http\Controllers\SchoolController;
    use App\Http\Controllers\DirectorController;
    use App\Http\Controllers\ExamController;
    use App\Http\Controllers\GroupController;
    use App\Http\Controllers\ModuleController;
    use App\Http\Controllers\OptionController;
    use Illuminate\Support\Facades\Auth;
    use Illuminate\Support\Facades\Route;
    
    // Public Routes
    Route::get('/', function () {
        return view('welcome');
    });
    
    Auth::routes();
    
    // User Registration
    Route::get('/registerUser', [RegisterController::class, 'showRegister'])->name('showregister');
    
    // Admin Routes
    Route::prefix('admin')->middleware(['auth', \App\Http\Middleware\AdminMiddleware::class])->group(function () {
        // User Management
        Route::delete('/users/{user}/delete', [UserController::class, 'destroy'])->name('admin.deleteUser');
        Route::post('/directors/{id}/activate', [UserController::class, 'activateDirector'])->name('admin.activateDirector');
        Route::post('/directors/{id}/deactivate', [UserController::class, 'deactivateDirector'])->name('admin.deactivateDirector');
    
        // School Management
        Route::get('/schools', [SchoolController::class, 'showSchoolsList'])->name('admin.schoolsList');
        Route::delete('/schools/{school}', [SchoolController::class, 'destroySchool'])->name('admin.destroySchool');
        Route::get('/school/create', [SchoolController::class, 'createSchool'])->name('admin.createSchool');
        Route::post('/school/create', [SchoolController::class, 'storeSchool'])->name('admin.storeSchool');
        Route::get('/school/{school}/update', [SchoolController::class, 'modifySchool'])->name('admin.modifySchool');
        Route::put('/school/{school}/update', [SchoolController::class, 'updateSchool'])->name('admin.updateSchool');
        Route::get('/school/{school}/details', [SchoolController::class, 'schoolDetails'])->name('admin.schoolDetails');
    
        // Director Management
        Route::get('/directors', [DirectorController::class, 'showDirectorsList'])->name('admin.directorsList');
    });
    
    // User Routes
    Route::middleware('auth')->group(function () {
        Route::get('/users/{user}/update', [UserController::class, 'modifyUser'])->name('user.modifyUser');
        Route::put('/users/update/{user}', [UserController::class, 'update'])->name('user.update');
    });
    
    // Director Routes
    Route::prefix('director')->middleware(['auth', \App\Http\Middleware\DirectorMiddleware::class])->group(function () {
        // Activate / Deactivate Student and Professor
        Route::post('/users/{id}/activate', [DirectorController::class, 'activateStudentOrProfessor'])->name('director.activateStudentOrProfessor');
        Route::post('/users/{id}/deactivate', [DirectorController::class, 'deactivateStudentOrProfessor'])->name('director.deactivateStudentOrProfessor');
       
        // User Management
        Route::delete('/users/{user}/delete', [UserController::class, 'destroy'])->name('admin.deleteUser');
    
        // Professor Management
        Route::get('/professors', [DirectorController::class, 'showProfessorsList'])->name('director.showProfessorsList');
    
        // Student Management
        Route::get('/students', [DirectorController::class, 'showStudentsList'])->name('director.showStudentsList');
    
        // Group Management
        Route::get('/groups', [GroupController::class, 'showGroupsList'])->name('director.showGroupsList');
        Route::get('/groups/create', [GroupController::class, 'createGroup'])->name('director.createGroup');
        Route::post('/groups/create', [GroupController::class, 'storeGroup'])->name('director.storeGroup');
        Route::get('/groups/{group}/update', [GroupController::class, 'editGroup'])->name('director.editGroup');
        Route::put('/groups/{group}/update', [GroupController::class, 'updateGroup'])->name('director.updateGroup');
        Route::delete('/groups/{group}/delete', [GroupController::class, 'destroyGroup'])->name('director.destroyGroup');
    
        // Option Management
        Route::get('/options', [OptionController::class, 'showOptionsList'])->name('director.showOptionsList');
        Route::get('/options/create', [OptionController::class,'createOption'])->name('director.createOption');
        Route::post('/options/create', [OptionController::class, 'storeOption'])->name('director.storeOption');
        Route::get('/options/{option}/update', [OptionController::class, 'editOption'])->name('director.editOption');
        Route::put('/options/{option}/update', [OptionController::class, 'updateOption'])->name('director.updateOption');
        Route::delete('/options/{option}/delete', [OptionController::class, 'destroyOption'])->name('director.destroyOption');
    
        // Modules Management
        Route::get('/modules', [ModuleController::class, 'showModulesList'])->name('director.showModulesList');
        Route::get('/modules/create', [ModuleController::class, 'createModule'])->name('director.createModule');
        Route::post('/modules/create', [ModuleController::class, 'storeModule'])->name('director.storeModule');
        Route::get('/modules/{module}/update', [ModuleController::class, 'editModule'])->name('director.editModule');
        Route::put('/modules/{module}/update', [ModuleController::class, 'updateModule'])->name('director.updateModule');
        Route::delete('/modules/{module}/delete', [ModuleController::class, 'destroyModule'])->name('director.deleteModule');
    
    });
    
    Route::prefix('professor')->middleware(['auth', \App\Http\Middleware\ProfessorMiddleware::class])->group(function () {
        // Exams Management
        Route::get('/exams', [ExamController::class, 'showExamsList'])->name('professor.showExamsList');
        Route::get('/exam/add', [ExamController::class, 'createExam'])->name('professor.crateExam');
        Route::post('/exams/add', [ExamController::class, 'storeExam'])->name('professor.storeExam');
        Route::get('/exam/{exam}/edit', [ExamController::class, 'editExam'])->name('professor.editExam');
        Route::put('/exam/{exam}/edit', [ExamController::class, 'updateExam'])->name('professor.updateExam');
        Route::delete('/exam/{exam}/delete', [ExamController::class, 'destroyExam'])->name('professor.destroyExam');
    });
    
    // Home Route
    Route::get('/home', [HomeController::class, 'index'])->name('home');
    

Views :

views

Layout views

layouts/app.blade.php


<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">

    <title>{{ config('app.name', 'Laravel') }}</title>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="//fonts.bunny.net">
    <link href="https://fonts.bunny.net/css?family=Nunito" rel="stylesheet">

    <!-- Scripts -->
    @vite(['resources/sass/app.scss', 'resources/js/app.js'])
  </head>

  <body>
    <div id="app">
      <nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
        <div class="container">
          <a class="navbar-brand fw-bold" href="{{ url('/') }}"
            style="background-color: rgb(197, 30, 197); color: white; padding: 10px 20px; border-radius: 5px; text-decoration: none;">
            EduManage
          </a>

          <button class="navbar-toggler" type="button" data-bs-toggle="collapse"
            data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
            aria-label="{{ __('Toggle navigation') }}">
            <span class="navbar-toggler-icon"></span>
          </button>

          <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <!-- Left Side Of Navbar -->
            <ul class="navbar-nav me-auto">

            </ul>

            <!-- Right Side Of Navbar -->
            <ul class="navbar-nav ms-auto">
              <!-- Authentication Links -->
              @guest
                @if (Route::has('login'))
                  <li class="nav-item">
                    <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
                  </li>
                @endif

                @if (Route::has('showregister'))
                  <li class="nav-item">
                    <a class="nav-link" href="{{ route('showregister') }}">{{ __('Register') }}</a>
                  </li>
                @endif
              @else
                <li class="nav-item dropdown">
                  <div class="d-flex dropdown-toggle align-items-center " data-bs-toggle="dropdown" aria-haspopup="true"
                    aria-expanded="false" v-pre>
                    <img src="/{{ Auth::user()->picture }}" alt="userProfile"
                      style="width: 30px; height:30px;border-radius:50%">
                    <a id="navbarDropdown" class="nav-link  fw-bolder" href="#" role="button">
                      {{ Auth::user()->firstName }} {{ Auth::user()->lastName }}
                    </a>
                  </div>

                  <div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
                    <span class="dropdown-item fw-bolder">
                      {{ Auth::user()->role->name }}
                      @if (Auth::user()->active == 0)
                        <span class="text-danger"> ( Not activated )</span>
                      @elseif (Auth::user()->active == 1)
                        <span class="text-success"> ( Activated )</span>
                      @endif
                    </span>

                    <a href="{{ url('/home') }}" class="dropdown-item fw-bold">Home</a>
                    <a href="{{ route('user.modifyUser', Auth()->user()) }}" class="dropdown-item fw-bold">
                      Account
                    </a>
                    @if (Auth::user()->role->name === 'sysAdmin')
                      <a href="{{ route('admin.directorsList') }}" class="dropdown-item fw-bold">Directeurs List</a>
                      <a href="{{ route('admin.schoolsList') }}" class="dropdown-item fw-bold">Schools List</a>
                    @endif

                    @if (Auth::user()->role->name === 'Director' && Auth::user()->active === 1)
                      <a href="{{ route('director.showProfessorsList') }}" class="dropdown-item fw-bold">Professors
                        list</a>
                      <a href="{{ route('director.showStudentsList') }}" class="dropdown-item fw-bold">Students list</a>

                      <a href="{{ route('director.showGroupsList') }}" class="dropdown-item fw-bold">Groups list</a>

                      <a href="{{ route('director.showOptionsList') }}" class="dropdown-item fw-bold">Options list</a>

                      <a href="{{ route('director.showModulesList') }}" class="dropdown-item fw-bold">Modules list</a>
                    @endif

                    @if (Auth::user()->role->name === 'Professor' && Auth::user()->active === 1)
                      <a href="{{ route('professor.showExamsList') }}" class="dropdown-item fw-bold">Exams list</a>
                    @endif


                    <a class="dropdown-item fw-bolder" href="{{ route('logout') }}"
                      onclick="event.preventDefault();
                    document.getElementById('logout-form').submit();">
                      {{ __('Logout') }}
                    </a>


                    <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
                      @csrf
                    </form>
                  </div>
                </li>
              @endguest
            </ul>
          </div>
        </div>
      </nav>

      <main class="py-4">
        @yield('content')
      </main>
    </div>
  </body>

</html>

Auth views

auth/register.blade.php


    @extends('layouts.app')

@section('content')
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-md-8">
        <div class="card">
          <div class="card-header">
            <h1 class="navbar-brand fw-bold text-center "
              style="background-color: rgba(197, 30, 197, 0.8); color: white; padding: 10px 20px; border-radius: 5px; text-decoration: none;">
              EduManage
            </h1>
          </div>

          <div class="card-body">
            <h4 class="text-center fw-bold mt-2 my-4 h2">Create your personal account now</h4>
            <form method="POST" action="{{ route('register') }}" enctype="multipart/form-data">
              @csrf

              <div class="row mb-3">
                <label for="firstName" class="col-md-4 col-form-label text-md-end">{{ __('First name') }}</label>
                <div class="col-md-6">
                  <input id="firstName" type="text" class="form-control @error('firstName') is-invalid @enderror"
                    name="firstName" value="{{ old('firstName') }}" required autocomplete="firstName" autofocus>
                  @error('firstName')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="lastName" class="col-md-4 col-form-label text-md-end">{{ __('Last name') }}</label>
                <div class="col-md-6">
                  <input id="lastName" type="text" class="form-control @error('lastName') is-invalid @enderror"
                    name="lastName" value="{{ old('lastName') }}" required autocomplete="lastName">
                  @error('lastName')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="idRole" class="col-md-4 col-form-label text-md-end">{{ __('Role') }}</label>
                <div class="col-md-6">
                  <select id="idRole" class="form-control @error('idRole') is-invalid @enderror" name="idRole"
                    required onchange="toggleCNEField()">
                    <option value="" disabled selected>Select a role</option>
                    @foreach ($rolesList->take(3) as $role)
                      <option value="{{ $role->idRole }}" {{ old('idRole') == $role->idRole ? 'selected' : '' }}>
                        {{ $role->name }}</option>
                    @endforeach
                  </select>
                  @error('idRole')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="school_id" class="col-md-4 col-form-label text-md-end">{{ __('School') }}</label>
                <div class="col-md-6">
                  <select id="school_id" class="form-control @error('school_id') is-invalid @enderror" name="school_id"
                    required>
                    <option value="" disabled selected>Select a school</option>
                    @foreach ($schoolsList as $school)
                      <option value="{{ $school->id }}" {{ old('school_id') == $school->id ? 'selected' : '' }}>
                        {{ $school->name }}</option>
                    @endforeach
                  </select>
                  @error('school_id')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div id="CNEField" style="display: none">
                <div class="row mb-3">
                  <label for="CNE" class="col-md-4 col-form-label text-md-end">CNE</label>
                  <div class="col-md-6">
                    <input id="CNE" type="text" class="form-control @error('CNE') is-invalid @enderror"
                      name="CNE" value="{{ old('CNE') }}" autocomplete="CNE">
                    @error('CNE')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
                </div>

                <div class="row mb-3">
                  <label for="group_id" class="col-md-4 col-form-label text-md-end">{{ __('Group') }}</label>
                  <div class="col-md-6">
                    <select id="group_id" class="form-control @error('group_id') is-invalid @enderror" name="group_id">
                      <option value="" disabled selected>Select a group</option>
                      @foreach ($groupsList as $group)
                        <option value="{{ $group->id }}" {{ old('group_id') == $group->id ? 'selected' : '' }}>
                          {{ $group->name }}</option>
                      @endforeach
                    </select>
                    @error('group_id')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
                </div>
              </div>


              <div class="row mb-3">
                <label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
                <div class="col-md-6">
                  <input id="email" type="email" class="form-control @error('email') is-invalid @enderror"
                    name="email" value="{{ old('email') }}" required autocomplete="email">
                  @error('email')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="profilePicture" class="col-md-4 col-form-label text-md-end">Profile picture</label>
                <div class="col-md-6">
                  <input type="file" name="profilePicture" id="profilePicture"
                    class="form-control @error('profilePicture') is-invalid @enderror" required>
                  @error('profilePicture')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
                <div class="col-md-6">
                  <input id="password" type="password" class="form-control @error('password') is-invalid @enderror"
                    name="password" required autocomplete="new-password">
                  @error('password')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="password-confirm"
                  class="col-md-4 col-form-label text-md-end">{{ __('Confirm Password') }}</label>
                <div class="col-md-6">
                  <input id="password-confirm" type="password" class="form-control" name="password_confirmation"
                    required autocomplete="new-password">
                </div>
              </div>

              <div class="row mb-0">
                <div class="col-md-6 offset-md-4">
                  <button type="submit" class="btn btn-primary">
                    {{ __('Register') }}
                  </button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>

  <script>
    document.addEventListener('DOMContentLoaded', function() {
      toggleCNEField();
    });

    function toggleCNEField() {
      var roleSelect = document.getElementById('idRole');
      var cneField = document.getElementById('CNEField');
      var selectedRole = roleSelect.options[roleSelect.selectedIndex].text;
      console.log(cneField);

      if (selectedRole === 'Student') {
        cneField.style.display = 'block';
      } else {
        cneField.style.display = 'none';
      }
    }
  </script>
@endsection

auth/login.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container-fluid">
        <div class="row justify-content-center">
          <div class="col-md-8">
            <div class="card">
              <div class="card-header">
                <h1 class="navbar-brand fw-bold text-center "
                  style="background-color: rgba(197, 30, 197, 0.8); color: white; padding: 10px 20px; border-radius: 5px; text-decoration: none;">
                  EduManage
                </h1>
              </div>
    
              <div class="card-body">
                <h4 class="text-center fw-bold mt-2 my-4 h2">Log in to your personal account</h4>
                <form method="POST" action="{{ route('login') }}" autocomplete="off">
                  @csrf
    
                  <div class="row mb-3">
                    <label for="email" class="col-md-4 col-form-label text-md-end">{{ __('Email Address') }}</label>
    
                    <div class="col-md-6">
                      <input id="email" type="email" class="form-control @error('email') is-invalid @enderror"
                        name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
    
                      @error('email')
                        <span class="invalid-feedback" role="alert">
                          <strong>{{ $message }}</strong>
                        </span>
                      @enderror
                    </div>
                  </div>
    
                  <div class="row mb-3">
                    <label for="password" class="col-md-4 col-form-label text-md-end">{{ __('Password') }}</label>
    
                    <div class="col-md-6">
                      <input id="password" type="password" class="form-control @error('password') is-invalid @enderror"
                        name="password" required autocomplete="current-password">
    
                      @error('password')
                        <span class="invalid-feedback" role="alert">
                          <strong>{{ $message }}</strong>
                        </span>
                      @enderror
                    </div>
                  </div>
    
                  <div class="row mb-3">
                    <div class="col-md-6 offset-md-4">
                      <div class="form-check">
                        <input class="form-check-input" type="checkbox" name="remember" id="remember"
                          {{ old('remember') ? 'checked' : '' }}>
    
                        <label class="form-check-label" for="remember">
                          {{ __('Remember Me') }}
                        </label>
                      </div>
                    </div>
                  </div>
    
                  <div class="row mb-0">
                    <div class="col-md-8 offset-md-4">
                      <button type="submit" class="btn btn-primary">
                        {{ __('Login') }}
                      </button>
    
                      @if (Route::has('password.request'))
                        <a class="btn btn-link" href="{{ route('password.request') }}">
                          {{ __('Forgot Your Password?') }}
                        </a>
                      @endif
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    

Admin views

admin/directeursList.blade.php



    @extends('layouts.app')

@section('content')
  <div class="container"<
    @if (session('success'))
      <div class="d-flex justify-content-center"<
        <div class="alert alert-success alert-dismissible fade show col-6" role="alert"<
          {{ session('success') }}
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"<</button<
        </div<
      </div<
    @endif
    <div class="card"<
      <div class="card-header h4 fw-bold d-flex justify-content-between"<
        <h3<Directors List</h3<
      </div<

      <div class="card-body"<
        <table class="table"<
          <thead<
            <tr<
              <th class="align-middle"<ID</th<
              <th class="align-middle"<Full Name</th<
              <th class="align-middle"<Email</th<
              <th class="align-middle"<School</th<
              <th class="align-middle"<Status</th<
              <th class="align-middle"<Actions</th<
            </tr<
          </thead<
          <tbody<
            @forelse ($directeursList as $user)
              <tr<
                <td class="align-middle"<{{ $user-<id }}</td<
                <td class="align-middle"<{{ $user-<firstName }} {{ $user-<lastName }}</td<
                <td class="align-middle"<{{ $user-<email }}</td<
                <td class="align-middle"<{{ $user-<school-<name }}</td<
                <td class="align-middle"<
                  @if ($user-<active === 1)
                    <span class="text-success fw-bold"<Active</span<
                  @else
                    <span class="text-danger fw-bold"<Inactive</span<
                  @endif
                </td<
                <td class="align-middle"<
                  <div class="d-flex" role="group"<
                    @if ($user-<active === 1)
                      <form action="{{ route('admin.deactivateDirector', $user-<id) }}" method="POST" class="me-1"<
                        @csrf
                        <button type="submit" class="btn btn-warning"<Deactivate</button<
                      </form<
                    @else
                      <form action="{{ route('admin.activateDirector', $user-<id) }}" method="POST" class="me-1"<
                        @csrf
                        <button type="submit" class="btn btn-success"<Activate</button<
                      </form<
                    @endif
                    <form action="{{ route('admin.deleteUser', $user) }}" method="POST" class="ms-1"<
                      @csrf
                      @method('DELETE')
                      <button type="submit" class="btn btn-danger"<Delete</button<
                    </form<
                  </div<
                </td<
              </tr<
            @empty
              <tr<
                <td class="bg-danger-subtle fw-bold text-center h4" colspan="6"<No users available</td<
              </tr<
            @endforelse
          </tbody<
        </table<
      </div<
    </div<
  </div<
@endsection

    

admin/schoolsList.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
        @if (session('success'))
          <div class="d-flex justify-content-center">
            <div class="alert alert-success alert-dismissible fade show col-6 " role="alert">
              {{ session('success') }}
              <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
          </div>
        @endif
        <div class="card">
          <div class="card-header h4 fw-bold d-flex justify-content-between ">
    
            <h3> Schools List</h3>
            <a href="{{ route('admin.createSchool') }}" class="btn btn-primary">Add a school</a>
          </div>
    
          <div class="card-body">
    
            <table class="table ">
              <thead>
                <tr>
                  <th class="align-middle">ID</th>
                  <th class="align-middle">Name</th>
                  <th class="align-middle">Address</th>
                  <th class="align-middle">Picture</th>
                  <th class="align-middle">Actions</th>
    
                </tr>
              </thead>
              <tbody>
                @forelse ($schoolsList as $school)
                  <tr>
                    <td class="align-middle">{{ $school->id }}</td>
                    <td class="align-middle">{{ $school->name }} </td>
                    <td class="align-middle">{{ $school->address }}</td>
                    <td class="align-middle">
                      <img src="/{{ $school->picture }}" alt="schoolPicture"
                        style="width: 50px; height:50px;border-radius:50%" />
                    </td>
                    <td class="align-middle">
                      <div class="d-flex" role="group">
                        <a href="{{ route('admin.schoolDetails', $school) }}" class="btn btn-primary">Details</a>
                        <form action="{{ route('admin.destroySchool', $school) }}" method="POST">
                          @csrf
                          @method('DELETE')
                          <button class="btn btn-danger ms-1">Delete</button>
    
                        </form>
                        <a href="{{ route('admin.modifySchool', $school) }}" class="btn btn-success ms-1">Update</a>
                      </div>
    
                    </td>
    
                  </tr>
                @empty
                  <tr>
                    <td class="bg-danger-subtle fw-bold text-center h4" colspan="5">No users available</td>
                  </tr>
                @endforelse
              </tbody>
            </table>
    
          </div>
        </div>
      </div>
    @endsection
    
    

Exam views

exam/examsList.blade.php


    @extends('layouts.app')

@section('content')
  <div class="container">
    @if (session('success'))
      <div class="alert alert-success alert-dismissible fade show" role="alert">
        {{ session('success') }}
        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
      </div>
    @endif
    <div class="row justify-content-center">
      <div class="col-md-10">
        <div class="card">
          <div class="card-header bg-dark text-white d-flex justify-content-between align-items-center">
            <h3 class="m-0">{{ __('Exams List') }}</h3>
            <a href="{{ route('professor.crateExam') }}" class="btn btn-primary">Add Exam</a>
          </div>

          <div class="card-body">
            <div class="table-responsive">
              <table class="table table-bordered table-hover">
                <thead class="bg-primary text-white">
                  <tr>
                    <th>ID</th>
                    <th>Name</th>
                    <th>Mark</th>
                    <th>Module Name</th>
                    <th>Student</th>
                    <th>Actions</th>
                  </tr>
                </thead>
                <tbody>
                  @forelse ($exams as $exam)
                    <tr>
                      <td>{{ $exam->id }}</td>
                      <td>{{ $exam->name }}</td>
                      <td>{{ $exam->mark }}</td>
                      <td>{{ $exam->module->name }}</td>
                      <td>{{ $exam->student->user->firstName }} {{ $exam->student->user->lastName }}</td>
                      <td>
                        <a href="{{ route('professor.editExam', $exam) }}" class="btn btn-success">Edit</a>
                        <form action="{{ route('professor.destroyExam', $exam) }}" method="POST"
                          style="display: inline-block;">
                          @csrf
                          @method('DELETE')
                          <button type="submit" class="btn btn-danger">Delete</button>
                        </form>
                      </td>
                    </tr>
                  @empty
                    <tr>
                      <td colspan="6" class="text-center fw-bold h4">No exams available.</td>
                    </tr>
                  @endforelse
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
@endsection

exam/create.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-md-6">
            <div class="card">
              <div class="card-header">Add Exam</div>
              <div class="card-body">
                <form action="{{ route('professor.storeExam') }}" method="POST" autocomplete="off">
                  @csrf
                  <div class="form-group mb-3">
                    <label for="name">Exam Name</label>
                    <input type="text" class="form-control  @error('name') is-invalid @enderror" id="name"
                      name="name" placeholder="Enter exam name" value="{{ old('name') }}" required>
                  </div>
                  @error('name')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                  <div class="form-group mb-3">
                    <label for="mark">Mark</label>
                    <input type="number" step="0.01" class="form-control  @error('mark') is-invalid @enderror"
                      id="mark" name="mark" placeholder="Enter exam mark" value="{{ old('mark') }}" required>
                  </div>
                  @error('mark')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                  <div class="form-group mb-3">
                    <label for="student_id">Student</label>
                    <select class="form-control  @error('student_id') is-invalid @enderror" id="student_id" name="student_id"
                      required>
                      <option value="">Select a student</option>
                      @foreach ($students as $student)
                        <option value="{{ $student->id }}">{{ $student->user->firstName }} {{ $student->user->lastName }}
                        </option>
                      @endforeach
                    </select>
                  </div>
                  @error('student_id')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                  <div class="form-group mb-3">
                    <label for="module_id">Module</label>
                    <select class="form-control  @error('module_id') is-invalid @enderror" id="module_id" name="module_id"
                      required>
                      <option value="">Select a module</option>
                      @foreach ($modules as $module)
                        <option value="{{ $module->id }}">{{ $module->name }}</option>
                      @endforeach
                    </select>
                  </div>
                  @error('module_id')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                  <div>
                    <button type="submit" class="btn btn-primary">Add</button>
                    <a href="{{ route('professor.showExamsList') }}" class="btn btn-danger">Cancel</a>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection

exam/edit.blade.php


    @extends('layouts.app')

@section('content')
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-md-6">
        <div class="card">
          <div class="card-header">Edit Exam with the ID : {{ $exam->id }}</div>
          <div class="card-body">
            <form action="{{ route('professor.updateExam', $exam) }}" method="POST" autocomplete="off">
              @csrf
              @method('PUT')
              <div class="form-group mb-3">
                <label for="name">Exam Name</label>
                <input type="text" class="form-control" id="name" name="name" placeholder="Enter exam name"
                  value="{{ old('name', $exam->name) }}" required>
              </div>
              <div class="form-group mb-3">
                <label for="mark">Mark</label>
                <input type="number" step="0.01" class="form-control" id="mark" name="mark"
                  placeholder="Enter exam mark" value="{{ old('mark', $exam->mark) }}" required>
              </div>
              <div class="form-group mb-3">
                <label for="student_id">Student</label>
                <select class="form-control" id="student_id" name="student_id" required>
                  <option value="">Select a student</option>
                  @foreach ($students as $student)
                    <option value="{{ $student->id }}"
                      {{ $student->id == old('student_id', $exam->student_id) ? 'selected' : '' }}>
                      {{ $student->user->firstName }} {{ $student->user->lastName }}
                    </option>
                  @endforeach
                </select>
              </div>
              <div class="form-group mb-3">
                <label for="module_id">Module</label>
                <select class="form-control" id="module_id" name="module_id" required>
                  <option value="">Select a module</option>
                  @foreach ($modules as $module)
                    <option value="{{ $module->id }}"
                      {{ $module->id == old('module_id', $exam->module_id) ? 'selected' : '' }}>
                      {{ $module->name }}
                    </option>
                  @endforeach
                </select>
              </div>
              <div>
                <button type="submit" class="btn btn-primary">Update</button>
                <a href="{{ route('professor.showExamsList') }}" class="btn btn-danger">Cancel</a>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
@endsection

Group views

group/groupsList.blade.php


    
    @extends('layouts.app')

    @section('content')
      <div class="container">
        @if (session('success'))
          <div class="d-flex justify-content-center">
            <div class="alert alert-success alert-dismissible fade show col-6" role="alert">
              {{ session('success') }}
              <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
          </div>
        @endif
        <div class="row justify-content-center">
          <div class="col-md-10">
            <div class="card">
              <div class="card-header d-flex justify-content-between align-items-center">
                <h3>{{ __('Groups List') }}</h3>
                <a href="{{ route('director.createGroup') }}" class="btn btn-primary">Add</a>
              </div>
    
              <div class="card-body">
                <table class="table">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>Name</th>
                      <th>Description</th>
                      <th>Number of students</th>
                      <th>Actions</th>
                    </tr>
                  </thead>
                  <tbody>
                    @forelse ($groupsList as $group)
                      <tr>
                        <td>{{ $group->id }}</td>
                        <td>{{ $group->name }}</td>
                        <td>{{ $group->description }}</td>
                        <td>{{ count($group->student) }}</td>
                        <td>
                          <a href="{{ route('director.editGroup', $group) }}" class="btn btn-success">Edit</a>
                          <form action="{{ route('director.destroyGroup', $group) }}" method="POST"
                            style="display: inline-block;">
                            @csrf
                            @method('DELETE')
                            <button type="submit" class="btn btn-danger">Delete</button>
                          </form>
                        </td>
                      </tr>
                    @empty
                      <tr>
                        <td colspan="5" class="text-center fw-bold h4">No groups available.</td>
                      </tr>
                    @endforelse
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    

group/create.blade.php


    
    @extends('layouts.app')

@section('content')
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-md-8">
        <div class="card">
          <div class="card-header">Add Group</div>
          <div class="card-body">
            <form action="{{ route('director.storeGroup') }}" method="POST" autocomplete="off">
              @csrf
              <div class="form-group mb-3">
                <label for="name">Group Name</label>
                <input type="text" class="form-control" id="name" name="name" placeholder="Enter group name"
                  value="{{ old('name') }}">
              </div>
              <div class="form-group mb-3">
                <label for="description">Description</label>
                <textarea class="form-control" id="description" name="description" rows="3" placeholder="Enter group description"
                  value="{{ old('description') }}"></textarea>
              </div>
              <div>
                <button type="submit" class="btn btn-primary">Add</button>
                <a href="{{ route('director.showGroupsList') }}" class="btn btn-danger">Cancel</a>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
@endsection

group/edit.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-md-8">
            <div class="card">
              <h3 class="card-header">Edit the group with the ID : {{ $group->id }}</h3>
              <div class="card-body">
                <form action="{{ route('director.updateGroup', $group) }}" method="POST" autocomplete="off">
                  @csrf
                  @method('PUT')
                  <div class="form-group mb-3">
                    <label for="name">Group Name</label>
                    <input type="text" class="form-control" id="name" name="name" placeholder="Enter group name"
                      value="{{ old('name', $group->name) }}">
                  </div>
                  <div class="form-group mb-3">
                    <label for="description">Description</label>
                    <textarea class="form-control" id="description" name="description" rows="3" placeholder="Enter group description">{{ old('description', $group->description) }}</textarea>
                  </div>
                  <div>
                    <button type="submit" class="btn btn-success">Update</button>
                    <a href="{{ route('director.showGroupsList') }}" class="btn btn-danger">Cancel</a>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    

Module views

module/modulesList.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
        @if (session('success'))
          <div class="alert alert-success alert-dismissible fade show" role="alert">
            {{ session('success') }}
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
          </div>
        @endif
        <div class="row justify-content-center">
          <div class="col-md-10">
            <div class="card">
              <div class="card-header bg-dark text-white d-flex justify-content-between align-items-center">
                <h3 class="m-0">{{ __('Modules List') }}</h3>
                <a href="{{ route('director.createModule') }}" class="btn btn-primary">Add Module</a>
              </div>
    
              <div class="card-body">
                <div class="table-responsive">
                  <table class="table table-bordered table-hover">
                    <thead class="bg-primary text-white">
                      <tr>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Number of Hours</th>
                        <th>Option</th>
                        <th>Group</th>
                        <th>Actions</th>
                      </tr>
                    </thead>
                    <tbody>
                      @forelse ($modulesList as $module)
                        <tr>
                          <td>{{ $module->id }}</td>
                          <td>{{ $module->name }}</td>
                          <td>{{ $module->numberOfHours }}</td>
                          <td>{{ $module->option->name }}</td>
                          <td>{{ $module->group->name }}</td>
                          <td>
                            <a href="{{ route('director.editModule', $module) }}" class="btn btn-success ">Edit</a>
                            <form action="{{ route('director.deleteModule', $module) }}" method="POST"
                              style="display: inline-block;">
                              @csrf
                              @method('DELETE')
                              <button type="submit" class="btn btn-danger ">Delete</button>
                            </form>
                          </td>
                        </tr>
                      @empty
                        <tr>
                          <td colspan="6" class="text-center fw-bold h4">No modules available.</td>
                        </tr>
                      @endforelse
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    
    

module/create.blade.php


    
    @extends('layouts.app')

    @section('content')
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-md-8">
            <div class="card">
              <div class="card-header bg-dark text-white">{{ __('Create Module') }}</div>
    
              <div class="card-body">
                <form method="POST" action="{{ route('director.storeModule') }}" autocomplete="off">
                  @csrf
    
                  <div class="mb-3">
                    <label for="name" class="form-label">{{ __('Module Name') }}</label>
                    <input id="name" type="text" class="form-control @error('name') is-invalid @enderror"
                      name="name" value="{{ old('name') }}" required autofocus>
                    @error('name')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <label for="hours" class="form-label">{{ __('Number of Hours') }}</label>
                    <input id="hours" type="number" class="form-control @error('hours') is-invalid @enderror"
                      name="numberOfHours" value="{{ old('numberOfHours') }}" required>
                    @error('hours')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <label for="option_id" class="form-label">{{ __('Option') }}</label>
                    <select id="option_id" class="form-select @error('option_id') is-invalid @enderror" name="option_id"
                      required>
                      <option value="" selected disabled>Select an Option</option>
                      @foreach ($optionsList as $option)
                        <option value="{{ $option->id }}">{{ $option->name }}</option>
                      @endforeach
                    </select>
                    @error('option_id')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <label for="group_id" class="form-label">{{ __('Group') }}</label>
                    <select id="group_id" class="form-select @error('group_id') is-invalid @enderror" name="group_id"
                      required>
                      <option value="" selected disabled>Select a Group</option>
                      @foreach ($groupsList as $group)
                        <option value="{{ $group->id }}">{{ $group->name }}</option>
                      @endforeach
                    </select>
                    @error('group_id')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <button type="submit" class="btn btn-primary">{{ __('Create Module') }}</button>
                    <a href="{{ route('director.showModulesList') }}" class="btn btn-danger">Cancel</a>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    

module/edit.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
        <div class="row justify-content-center">
          <div class="col-md-8">
            <div class="card">
              <div class="card-header bg-dark text-white">Update Module with the ID : {{ $module->id }}</div>
    
              <div class="card-body">
                <form method="POST" action="{{ route('director.updateModule', $module) }}" autocomplete="off">
                  @csrf
                  @method('PUT')
    
                  <div class="mb-3">
                    <label for="name" class="form-label">{{ __('Module Name') }}</label>
                    <input id="name" type="text" class="form-control @error('name') is-invalid @enderror"
                      name="name" value="{{ $module->name }}" required autofocus>
                    @error('name')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <label for="numberOfHours" class="form-label">{{ __('Number of Hours') }}</label>
                    <input id="numberOfHours" type="number" class="form-control @error('numberOfHours') is-invalid @enderror"
                      name="numberOfHours" value="{{ $module->numberOfHours }}" required>
                    @error('numberOfHours')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <label for="option_id" class="form-label">{{ __('Option') }}</label>
                    <select id="option_id" class="form-select @error('option_id') is-invalid @enderror" name="option_id"
                      required>
                      <option value="" selected disabled>Select an Option</option>
                      @foreach ($optionsList as $option)
                        <option value="{{ $option->id }}" {{ $module->option_id == $option->id ? 'selected' : '' }}>
                          {{ $option->name }}
                        </option>
                      @endforeach
                    </select>
                    @error('option_id')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <label for="group_id" class="form-label">{{ __('Group') }}</label>
                    <select id="group_id" class="form-select @error('group_id') is-invalid @enderror" name="group_id"
                      required>
                      <option value="" selected disabled>Select a Group</option>
                      @foreach ($groupsList as $group)
                        <option value="{{ $group->id }}" {{ $module->group_id == $group->id ? 'selected' : '' }}>
                          {{ $group->name }}
                        </option>
                      @endforeach
                    </select>
                    @error('group_id')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
    
                  <div class="mb-3">
                    <button type="submit" class="btn btn-success">{{ __('Update Module') }}</button>
                    <a href="{{ route('director.showModulesList') }}" class="btn btn-danger">Cancel</a>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    

Option views

option/optionList.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
        @if (session('success'))
          <div class="d-flex justify-content-center">
            <div class="alert alert-success alert-dismissible fade show col-6" role="alert">
              {{ session('success') }}
              <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
          </div>
        @endif
        <div class="row justify-content-center">
          <div class="col-md-10">
            <div class="card">
              <div class="card-header d-flex justify-content-between align-items-center">
                <h3>{{ __('Options List') }}</h3>
                <a href="{{ route('director.createOption') }}" class="btn btn-primary">Add</a>
              </div>
    
              <div class="card-body">
                <table class="table">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>Name</th>
                      <th>School</th>
                      <th>Actions</th>
                    </tr>
                  </thead>
                  <tbody>
                    @forelse ($optionsList as $option)
                      <tr>
                        <td>{{ $option->id }}</td>
                        <td>{{ $option->name }}</td>
                        <td>{{ $option->school->name }}</td>
                        <td>
                          <a href="{{ route('director.editOption', $option) }}" class="btn btn-success">Edit</a>
                          <form action="{{ route('director.destroyOption', $option) }}" method="POST"
                            style="display: inline-block;">
                            @csrf
                            @method('DELETE')
                            <button type="submit" class="btn btn-danger">Delete</button>
                          </form>
                        </td>
                      </tr>
                    @empty
                      <tr>
                        <td colspan="4" class="text-center fw-bold h4">No options available.</td>
                      </tr>
                    @endforelse
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    
   
    
    

option/create.blade.php


    
    
    @extends('layouts.app')

@section('content')
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-md-8">
        <div class="card">
          <div class="card-header">{{ __('Create Option') }}</div>

          <div class="card-body">
            <form method="POST" action="{{ route('director.storeOption') }}" autocomplete="off">
              @csrf

              <div class="mb-3">
                <label for="name" class="form-label">{{ __('Name') }}</label>
                <input id="name" type="text" class="form-control @error('name') is-invalid @enderror"
                  name="name" value="{{ old('name') }}" required autofocus>
                @error('name')
                  <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                  </span>
                @enderror
              </div>

              <div class="mb-3">
                <button type="submit" class="btn btn-primary">{{ __('Create') }}</button>
                <a href="{{ route('director.showOptionsList') }}" class="btn btn-danger">{{ __('Cancel') }}</a>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
@endsection

option/edit.blade.php


    @extends('layouts.app')

@section('content')
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-md-8">
        <div class="card">
          <div class="card-header">Edit option with the ID : {{ $option->id }} </div>

          <div class="card-body">
            <form method="POST" action="{{ route('director.updateOption', $option) }}" autocomplete="off">
              @csrf
              @method('PUT')

              <div class="mb-3">
                <label for="name" class="form-label">{{ __('Name') }}</label>
                <input id="name" type="text" class="form-control @error('name') is-invalid @enderror"
                  name="name" value="{{ $option->name }}" required autofocus>
                @error('name')
                  <span class="invalid-feedback" role="alert">
                    <strong>{{ $message }}</strong>
                  </span>
                @enderror
              </div>

              <div class="mb-3">
                <button type="submit" class="btn btn-primary">{{ __('Update') }}</button>
                <a href="{{ route('director.showOptionsList') }}" class="btn btn-danger">{{ __('Cancel') }}</a>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
@endsection

    

Professeur views

professor/professorsList.blade.php


    @extends('layouts.app')

@section('content')
  <div class="container">
    @if (session('success'))
      <div class="d-flex justify-content-center">
        <div class="alert alert-success alert-dismissible fade show col-6 " role="alert">
          {{ session('success') }}
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
      </div>
    @endif
    <div class="card">
      <div class="card-header h4 fw-bold d-flex justify-content-between ">

        <h3> Professors List</h3>
      </div>

      <div class="card-body">

        <table class="table ">
          <thead>
            <tr>
              <th class="align-middle">ID</th>
              <th class="align-middle">Full name</th>
              <th class="align-middle">Email</th>
              <th class="align-middle">School</th>
              <th class="align-middle">Status</th>
              <th class="align-middle">Actions</th>

            </tr>
          </thead>
          <tbody>
            @forelse ($professorsList as $user)
              <tr>
                <td class="align-middle">{{ $user->id }}</td>
                <td class="align-middle">{{ $user->firstName }} {{ $user->lastName }}</td>
                <td class="align-middle">{{ $user->email }}</td>
                <td class="align-middle">{{ $user->school_name }}</td>
                <td class="align-middle">
                  @if ($user->active === 1)
                    <span class="text-success fw-bold">Active</span>
                  @else
                    <span class="text-danger fw-bold">Inactive</span>
                  @endif
                </td>
                <td class="align-middle">
                  <div class="d-flex" role="group">
                    @if ($user->active === 1)
                      <form action="{{ route('director.deactivateStudentOrProfessor', $user->id) }}" method="POST">
                        @csrf
                        @method('POST')
                        <button type="submit" class="btn btn-warning me-1">Deactivate</button>
                      </form>
                    @else
                      <form action="{{ route('director.activateStudentOrProfessor', $user->id) }}" method="POST">
                        @csrf
                        @method('POST')
                        <button type="submit" class="btn btn-success me-1">Activate</button>
                      </form>
                    @endif
                    @if (Auth::user()->id === $user->id)
                      <button class="btn btn-danger ms-1" disabled>Delete</button>
                    @else
                      <form action="{{ route('admin.deleteUser', $user) }}" method="POST">
                        @csrf
                        @method('DELETE')
                        <button type="submit" class="btn btn-danger ms-1">Delete</button>
                      </form>
                    @endif
                  </div>
                </td>

              </tr>
            @empty
              <tr>
                <td class="bg-danger-subtle fw-bold text-center h4" colspan="6">No users available</td>
              </tr>
            @endforelse
          </tbody>
        </table>

      </div>
    </div>
  </div>
@endsection

School views

school/create.blade.php


    @extends('layouts.app')

@section('content')
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-md-8">
        <div class="card">
          <p class="card-header">Add a School</p>
          <div class="card-body">
            <form method="POST" enctype="multipart/form-data" action="{{ route('admin.storeSchool') }}">
              @csrf
              <div class="row mb-3">
                <label for="schoolName" class="col-md-4 col-form-label text-md-end">{{ __('School Name') }}</label>
                <div class="col-md-6">
                  <input id="schoolName" type="text" class="form-control @error('schoolName') is-invalid @enderror"
                    name="schoolName" value="{{ old('schoolName') }}" required autocomplete="schoolName" autofocus>
                  @error('schoolName')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="schoolAddress" class="col-md-4 col-form-label text-md-end">{{ __('School Address') }}</label>
                <div class="col-md-6">
                  <input id="schoolAddress" type="text"
                    class="form-control @error('schoolAddress') is-invalid @enderror" name="schoolAddress"
                    value="{{ old('schoolAddress') }}" required autocomplete="schoolAddress" autofocus>
                  @error('schoolAddress')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-3">
                <label for="schoolPicture" class="col-md-4 col-form-label text-md-end">School Picture</label>
                <div class="col-md-6">
                  <input type="file" name="schoolPicture" id="schoolPicture"
                    class="form-control @error('schoolPicture') is-invalid @enderror" required>
                  @error('schoolPicture')
                    <span class="invalid-feedback" role="alert">
                      <strong>{{ $message }}</strong>
                    </span>
                  @enderror
                </div>
              </div>

              <div class="row mb-0">
                <div class="col-md-6 offset-md-4">
                  <button type="submit" class="btn btn-primary">
                    Add
                  </button>
                  <a href="{{ route('admin.schoolsList') }}" class="btn btn-danger">Cancel</a>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
@endsection

school/details.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container my-5">
        <div class="row justify-content-center">
          <div class="col-md-8">
            <div class="card">
              <div class="card-header bg-primary text-white">
                <h3>{{ $school->name }}</h3>
              </div>
              <div class="card-body">
                <div class="mb-4">
                  <h5 class="text-primary">Address</h5>
                  <p>{{ $school->address }}</p>
                </div>
                <div class="mb-4">
                  <h5 class="text-primary">Directors</h5>
                  <ul class="list-group">
                    @forelse ($school->directors as $director)
                      <li class="list-group-item">
                        <div class="d-flex align-items-center">
                          <div class="mr-3">
                            <img src="/{{ $director->picture }}" alt="Director Picture" class="rounded-circle" width="50"
                              height="50">
                          </div>
                          <div class="ms-2">
                            <strong>{{ $director->firstName }} {{ $director->lastName }}</strong><br>
                            <small>{{ $director->email }}</small>
                          </div>
                        </div>
                      </li>
                    @empty
                      <li class="list-group-item">No directors assigned to this school.</li>
                    @endforelse
                  </ul>
                </div>
                <a href="{{ route('admin.schoolsList') }}" class="btn btn-primary">Back to School List</a>
              </div>
            </div>
          </div>
          <div class="col-md-4">
            <div class="card">
              <div class="card-header bg-primary text-white">
                <h5>Picture</h5>
              </div>
              <div class="card-body">
                @if ($school->picture)
                  <img src="/{{ $school->picture }}" alt="School Picture" class="img-fluid img-thumbnail"
                    style="max-width: full ; ">
                @else
                  <p>No picture available</p>
                @endif
              </div>
            </div>
          </div>
        </div>
      </div>
    @endsection
    

school/update.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
    
    
        <div class="d-flex justify-content-center mt-5">
          <div class="card col-8">
            <div class="card-header">
              {{ $school->name }} details
            </div>
            <div class="card-body">
              <form action="{{ route('admin.updateSchool', $school) }}" method="POST" enctype="multipart/form-data">
                @csrf
                @method('PUT')
    
                <div class="row mb-3">
                  <label for="schoolName" class="col-md-4 col-form-label text-md-end">{{ __('School Name') }}</label>
                  <div class="col-md-6">
                    <input id="schoolName" type="text" class="form-control @error('schoolName') is-invalid @enderror"
                      name="schoolName" value="{{ $school->name }}" required autocomplete="schoolName" autofocus>
                    @error('schoolName')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
                </div>
    
                <div class="row mb-3">
                  <label for="schoolAddress" class="col-md-4 col-form-label text-md-end">{{ __('School Address') }}</label>
                  <div class="col-md-6">
                    <input id="schoolAddress" type="text" class="form-control @error('schoolAddress') is-invalid @enderror"
                      name="schoolAddress" value="{{ $school->address }}" required autocomplete="schoolAddress" autofocus>
                    @error('schoolAddress')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
                </div>
    
                <div class="mb-3 row">
                  <div class="col-md-12  d-flex justify-content-center ms-3">
                    <img src="/{{ $school->picture }}" alt="{{ $school->name }}"
                      style="width: 300px; height:150px; border-radius:10px">
                  </div>
                </div>
    
                <div class="row mb-3">
                  <label for="schoolPicture" class="col-md-4 col-form-label text-md-end">School Picture</label>
                  <div class="col-md-6">
                    <input type="file" name="schoolPicture" id="schoolPicture"
                      class="form-control @error('schoolPicture') is-invalid @enderror">
                    @error('schoolPicture')
                      <span class="invalid-feedback" role="alert">
                        <strong>{{ $message }}</strong>
                      </span>
                    @enderror
                  </div>
                </div>
                <div class="row mb-0">
                  <div class="col-md-6 offset-md-4">
                    <button type="submit" class="btn btn-primary">
                      Update
                    </button>
                    <a href="{{ route('admin.schoolsList') }}" class="btn btn-danger">Cancel</a>
                  </div>
                </div>
            </div>
            </form>
          </div>
        </div>
      </div>
      </div>
    @endsection
    
    

Student views

student/studentsList.blade.php


    @extends('layouts.app')

@section('content')
  <div class="container">
    @if (session('success'))
      <div class="d-flex justify-content-center">
        <div class="alert alert-success alert-dismissible fade show col-6" role="alert">
          {{ session('success') }}
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
      </div>
    @endif
    @if (session('error'))
      <div class="d-flex justify-content-center">
        <div class="alert alert-danger alert-dismissible fade show col-6" role="alert">
          {{ session('error') }}
          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
      </div>
    @endif
    <div class="card">
      <div class="card-header h4 fw-bold d-flex justify-content-between">
        <h3>Students List</h3>
      </div>
      <div class="card-body">
        <table class="table">
          <thead>
            <tr>
              <th class="align-middle">ID</th>
              <th class="align-middle">Full Name</th>
              <th class="align-middle">CNE</th>
              <th class="align-middle">Email</th>
              <th class="align-middle">School</th>
              <th class="align-middle">Status</th>
              <th class="align-middle">Actions</th>
            </tr>
          </thead>
          <tbody>
            @forelse ($studentsList as $user)
              <tr>
                <td class="align-middle">{{ $user->user_id }}</td>
                <td class="align-middle">{{ $user->firstName }} {{ $user->lastName }}</td>
                <td class="align-middle">{{ $user->CNE }}</td>
                <td class="align-middle">{{ $user->email }}</td>
                <td class="align-middle">{{ $user->school->name }}</td>
                <td class="align-middle">
                  @if ($user->active === 1)
                    <span class="text-success fw-bold">Active</span>
                  @else
                    <span class="text-danger fw-bold">Inactive</span>
                  @endif
                </td>
                <td class="align-middle">
                  <div class="d-flex" role="group">
                    @if ($user->active === 1)
                      <form action="{{ route('director.deactivateStudentOrProfessor', $user->user_id) }}" method="POST"
                        class="me-1">
                        @csrf
                        <button type="submit" class="btn btn-warning">Deactivate</button>
                      </form>
                    @else
                      <form action="{{ route('director.activateStudentOrProfessor', $user->user_id) }}" method="POST"
                        class="me-1">
                        @csrf
                        <button type="submit" class="btn btn-success">Activate</button>
                      </form>
                    @endif
                    <form action="{{ route('admin.deleteUser', $user->user_id) }}" method="POST" class="ms-1">
                      @csrf
                      @method('DELETE')
                      <button type="submit" class="btn btn-danger">Delete</button>
                    </form>
                  </div>
                </td>
              </tr>
            @empty
              <tr>
                <td class="bg-danger-subtle fw-bold text-center h4" colspan="7">No users available</td>
              </tr>
            @endforelse
          </tbody>
        </table>
      </div>
    </div>
  </div>
@endsection

User views

user/update.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container">
        <h1>Hello {{ $user->firstName }}, welcome to your personal space,<br> {{ $user->role->name }} in
          {{ $user->school->name }}
          @if ($user->active == 0)
            <span class="text-danger"> ( Not activated )</span>
          @elseif ($user->active == 1)
            <span class="text-success"> ( Activated )</span>
          @endif
        </h1>
    
        <div class="d-flex justify-content-center mt-5">
          <div class="card col-8">
            <div class="card-header">
              Account details
            </div>
            <div class="card-body">
              <form action="{{ route('user.update', $user) }}" method="POST" enctype="multipart/form-data">
                @csrf
                @method('PUT')
                <div class="row">
                  <div class="col-md-6">
                    <div class="d-flex flex-column align-items-center">
                      <div class="mb-3">
                        <img src="/{{ $user->picture }}" alt="userProfile"
                          style="width: 100px; height: 100px; object-fit: cover;border-radius:50%" />
                      </div>
                      <div class="mb-3 w-100">
                        <label for="profilePicture" class="col-form-label text-md-end">Profile picture</label>
                        <input type="file" name="profilePicture" id="profilePicture"
                          class="form-control @error('profilePicture') is-invalid @enderror">
                        @error('profilePicture')
                          <span class="invalid-feedback" role="alert">
                            <strong>{{ $message }}</strong>
                          </span>
                        @enderror
                      </div>
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="mb-3">
                      <label for="firstName" class="col-form-label text-md-end">{{ __('First name') }}</label>
                      <input id="firstName" type="text" class="form-control @error('firstName') is-invalid @enderror"
                        name="firstName" value="{{ $user->firstName }}" autocomplete="firstName" autofocus>
                      @error('firstName')
                        <span class="invalid-feedback" role="alert">
                          <strong>{{ $message }}</strong>
                        </span>
                      @enderror
                    </div>
    
                    <div class="mb-3">
                      <label for="lastName" class="col-form-label text-md-end">{{ __('Last name') }}</label>
                      <input id="lastName" type="text" class="form-control @error('lastName') is-invalid @enderror"
                        name="lastName" value="{{ $user->lastName }}" autocomplete="lastName">
                      @error('lastName')
                        <span class="invalid-feedback" role="alert">
                          <strong>{{ $message }}</strong>
                        </span>
                      @enderror
                    </div>
    
                    <div class="mb-3">
                      <label for="email" class="col-form-label text-md-end">{{ __('Email Address') }}</label>
                      <input id="email" type="email" class="form-control @error('email') is-invalid @enderror"
                        name="email" value="{{ $user->email }}" autocomplete="email">
                      @error('email')
                        <span class="invalid-feedback" role="alert">
                          <strong>{{ $message }}</strong>
                        </span>
                      @enderror
                    </div>
    
                    <div class="mb-3">
                      <label for="password" class="col-form-label text-md-end">{{ __('Password') }}</label>
                      <input id="password" type="password" class="form-control @error('password') is-invalid @enderror"
                        name="password" autocomplete="new-password">
                      @error('password')
                        <span class="invalid-feedback" role="alert">
                          <strong>{{ $message }}</strong>
                        </span>
                      @enderror
                    </div>
    
                    <div class="d-flex justify-content-between ">
                      <button type="submit" class="btn btn-primary ">Update</button>
                      <a class="btn btn-danger" href="/home" class="btn btn-primary">Cancel</a>
                    </div>
                  </div>
                </div>
              </form>
            </div>
          </div>
        </div>
      </div>
    @endsection
    

Home view

home.blade.php


    @extends('layouts.app')

    @section('content')
      <div class="container-fluid p-0">
        <div class="d-flex justify-content-center">
          @if (session('success'))
            <div class="alert alert-success alert-dismissible fade show col-md-6" role="alert">
              {{ session('success') }}
              <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
            </div>
          @endif
        </div>
        <div class="row justify-content-center m-0"
          style="height: 80vh; background-image:url('{{ asset('backround.jpg') }}'); display:flex; align-items:center;">
          <div class="col-md-6 d-flex flex-column align-items-center justify-content-center text-center"
            style="background-color: white; height:200px; border-radius:10px">
    
            <div>
              <h1 class="text-secondary fw-bold">Hello {{ Auth()->user()->firstName }}</h1>
              <h2 class="text-secondary fw-bold">Welcome to your personal space</h2>
            </div>
          </div>
        </div>
      </div>
    @endsection