Actualización de moelo user y relación many con asistencias, creación del modelo de asistencia y control por middleware y autenticación

This commit is contained in:
2026-02-11 11:10:17 -06:00
parent 5c93101464
commit 5fe41a4557
25 changed files with 545 additions and 247 deletions
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Code extends Model
{
protected $guarded = [];
protected $casts = [
'registro' => 'datetime',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}
+8 -10
View File
@@ -37,14 +37,11 @@ class User extends Authenticatable
'direccion',
'plantel',
'password',
'code',
'status',
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
@@ -53,11 +50,7 @@ class User extends Authenticatable
'status',
];
/**
* The accessors to append to the model's array form.
*
* @var array<int, string>
*/
protected $appends = [
'profile_photo_url',
];
@@ -87,6 +80,11 @@ class User extends Authenticatable
return $this->hasMany(Note::class);
}
public function codes() : HasMany
{
return $this->hasMany(Code::class);
}
public function pagos() : HasMany
{
return $this->hasMany(Pago::class);