<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use App\Models\UserTypes;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
    protected $primaryKey = 'id';
    protected $fillable = [
        'user_name',
        'user_email',
        'ueser_create_id',
        'role_id',
        'password',
        'active_status'
    ];
    protected $hidden = [
        'password',
        'deleted_at',
        'created_at',
        'updated_at'
    ];

    public function projectAllocations()
{
    return $this->hasMany(ProjectAllocation::class, 'ueser_create_id', 'ueser_create_id');
}
    public function usersIds() {
        return $this->hasMany('App\Models\UsersCreate', 'ueser_create_id', 'ueser_create_id');
    }
    // public function projectAllocationIds() {
    //     return $this->hasMany('App\Models\ProjectAllocation', 'ueser_create_id', 'ueser_create_id');
    // }

    public function rolestypes() {
        return $this->hasMany('App\Models\Roles', 'role_id', 'role_id')->select('role_id', 'role_name');
    }
    
    public function usertypes() {
        return $this->hasMany('App\Models\UserTypes', 'id', 'user_type_id')->select('id', 'type_name');
    }
}
