Horas de Clase (Class Hours)
Routes
Method |
URI |
Action |
GET |
/class-hours |
index |
GET |
/class-hours/{id} |
show |
POST |
/class-hours |
store |
PATCH |
/class-hours/{id} |
update |
DELETE |
/class-hours/{id} |
delete |
Model Attributes
{
"id": 1,
"start_hour": 8, // numero del 0 al 23
"start_minute": 30, // numero del 0 al 59
"end_hour": 9, // numero del 0 al 23
"end_minute": 30, // numero del 0 al 59
"period_id": 1, // Periodo en el cual fue creado el horario de clase
"updated_at": "2020-04-30 11:30:39",
"created_at": "2020-04-30 11:30:39",
"deleted_at": null
}
Relations
- Pertenece a un periodo
BelongsTo period
- Tiene muchos horarios
HasMany schedules
{primary} Al obtener un modelo con el metodo show
o index
se puede utilizar un query string para cargar las relaciones
?with=relation
o ?with=relationA,relationB
Index
Route GET /class-hours
Policies
Filter |
Description |
period=id |
Obtiene las horas de clase de un periodo especifico |
Response 200
[
{
// ClassHour
}
]
Store
Route POST /class-hours
Policies
Request Body
{
// H === 00 -> 23
// i === 00 -> 59
"start_hour": "required|date_format:H",
"start_minute": "required|date_format:i",
"end_hour": "required|date_format:H",
"end_minute": "required|date_format:i",
"period_id": "required|integer|exists:periods,id"
}
Response 201
{
// ClassHour
}
Update
Route PATCH /class-hours/{id}
Policies
Request Body
{
// H === 00 -> 23
// i === 00 -> 59
"start_hour": "integer|date_format:H",
"start_minute": "integer|date_format:i",
"end_hour": "integer|date_format:H",
"end_minute": "integer|date_format:i"
}
Response 200
{
// ClassHour
}
Soft Delete
Route DELETE /class-hours/{id}
Policies
Response 204
No Content