<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
    use HasFactory, Notifiable;


    protected $table = 'user';
    public $timestamps = false;
    protected $primaryKey = 'id';

    protected $fillable = [
        'msnv',
        'name',
        'mail',
        'pass',
        'departments',
        'avatar',
        'role',
        'status',
        'card',
        'flag_send',
        'first_login',
    ];

    protected $hidden = [
        'pass',
    ];

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->pass;
    }

    // Disable remember token support in database
    public function getRememberToken()
    {
        return null;
    }

    public function setRememberToken($value)
    {
    }

    public function getRememberTokenName()
    {
        return '';
    }

    public function transactions()
    {
        return $this->hasMany(Administration::class, 'msnv', 'msnv');
    }

    public function cardPurchases()
    {
        return $this->hasMany(AddCard::class, 'buyer', 'msnv');
    }
}
