Overview
The Student model manages student-specific operations including creation, retrieval, deletion, and search. File:app/models/Student.php
Methods
getAll
Retrieves all students with their user information. SQL Query:Returns array of all student records ordered by name
create
Creates a new student record in both users and students tables.Student’s full name
Student’s email address
Plain text password (will be hashed)
Returns
true if student creation was successful, false otherwiseThe password is automatically hashed using PHP’s
password_hash() with PASSWORD_DEFAULT algorithm.delete
Deletes a student record (cascades to students table via foreign key).Student ID to delete
Returns
true if deletion was successful, false otherwisesearch
Searches for students by name or email using keyword matching.Search keyword (supports partial matches)
Returns array of matching student records
The search uses
LIKE with wildcards (%keyword%) to match partial strings in both name and email fields.