Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AbdulBazith's avatar

Attendance value problem in laravel

Guys iam working with a project School Management system.

i have a module Attendance for staff and student.

this is my attendance form for student: https://imgur.com/tkX80ql

here all the student for specific class is displayed with the options present, absent and half day. by default present is checked. if any student absent or half day that is changed and to be inserted into db.

My doubt is how can i insert this into database.

in my old project hotel project for employee module what i done is had attendance table like below

id      att_date        emp_id          att_count       reason  
1       01-10-19        3               1               null
2       01-10-19        4               0               fever so absent
3       01-10-19        5               0.5             half day personal work

in the above table 0=absent 1=present 0.5=halfday

this worked fine for my old project.

but it comes to report i faced many problems. because when need to take total count days for 1 month for specific employee i faced problems.

so iam asking suggestion for this project. how can i use tables for storing the attendance.

i need a report like below

Student         1       2       3       4       5       total(dates of single month)

Abdul           p       A       H       p       p       3.5  
Bazith          p       p       p       p       p       5

in the above report p=present H=half day A=Absent

if any holidays comes like Saturday and Sunday it must also be shown in the report. because if any holidays that day attendance are not taken. so in report that date should be displayed with the reason for that holiday.

Kindly some one help pleaseee..

0 likes
5 replies
tisuchi's avatar

So far I can understand that, the major changes between two projects are the value for the present, half-day and absent. So, in that case, why not you just count how many present and half day to get the total present in a month. Isn't that working for you?

Suggestion: To be honest, it is advisable to store a numeric number for your present, half day and absent value in db. It will be easier for handling.

2 likes
AbdulBazith's avatar

@tisuchi thank you for your suggestion.

ya you are right keeping numeric values is a better choice. i planned to keep that only.

But my problem is if any local holidays festival holidays therewill be no attendance and no records in the db.

so in report those days will be not shown. but my client is expecting the the holidays also to be shown in the screen.

say for example : if any local holiday means the reason should be inserted. so in the report that date should be shown as leave with reason.

do you understand?? else i confused you??

tisuchi's avatar

Then maybe you can use any local calendar to get the local holidays. Then you can apply your logic on that based on working days.

I am not sure, you can try google calendar also if it supports.

2 likes
AbdulBazith's avatar

@tisuchi ya ya you are right. using calendar is good option.

But another question raises in my mind. if i need to use calendar means then i need any table for that. else direct calendar can be used as UI.

and local holidays are decided suddenly as small small reasons. there will be no calendar occurs in net for all these holidays. some times if heavy rains means then leave will be provided by the area government.

so these also to be stored in db am i right??

for this i need to link the calendar and attendance. but i can get any idea how to do that.

Please or to participate in this conversation.