*/ use HasFactory; use HasProfilePhoto; use Notifiable; use TwoFactorAuthenticatable; use HasRoles; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'telefono', 'direccion', 'plantel', 'password', 'code', 'status', ]; protected $hidden = [ 'password', 'remember_token', 'two_factor_recovery_codes', 'two_factor_secret', 'status', ]; protected $appends = [ 'profile_photo_url', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } // public function note() : HasOne // { // //esta funcion es para retornar la relacion de un usario que contenga notas // return $this->hasOne(Note::class); // } public function notes() : HasMany { return $this->hasMany(Note::class); } public function codes() : HasMany { return $this->hasMany(Code::class); } public function pagos() : HasMany { return $this->hasMany(Pago::class); } public function plantelUsuarios() : BelongsToMany { return $this->belongsToMany(Plantel::class)->withPivot('plantel_id'); } public function existe($request = null) { if (!$request) { return false; } return $this->plantelUsuarios() ->wherePivot('plantel_id', $request) ->exists(); } public function prospectos() : BelongsToMany { return $this->belongsToMany(Prospecto::class); } }