<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Support\Facades\Auth;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];
    /*public function designation()
    {
        return $this->belongsTo('App\Models\Designation','fk_designation_id');
    }*/
    public function timezone()
    {
        return $this->belongsTo('App\Models\ClientTimezone','client_timezone_id');
    }
    public function client()
    {
        return $this->belongsTo('App\Models\Client','client_id');
    }
    public function roles(){
        return $this->belongsToMany('App\Models\ClientRole','acl_user_wise_role','user_id','acl_c_wise_role_id');
    }
    public function designation(){
        return $this->belongsTo('App\Models\ClientDesignation','client_designation_id');
    }
    public function userGroup(){
        return $this->belongsTo('App\Models\UserGroup','user_group_id');
    }
    public function scopeCompany($query){
        return $query->where('client_id',Auth::user()->client_id);
    }



}
