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:
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user