VaKeR CYBER ARMY
Logo of a company Server : Apache
System : Linux host44.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
User : vapecompany ( 2719)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/thread-self/root/home/vapecompany/demo.vapecompany.com.bd/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/thread-self/root/home/vapecompany/demo.vapecompany.com.bd/app/Models/User.php
<?php

namespace App\Models;

use Illuminate\Contracts\Auth\MustVerifyEmail;
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 $primaryKey = 'user_id';

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

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password',
        'remember_token',
    ];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'email_verified_at' => 'datetime',
    ];

    public function employee()
    {
        return $this->hasOne('App\Models\Emplyoee','user_id');
    }

     public function getrole()
    {
        $role_id= UserRole::where('user_id',$this->user_id)->first()->role_id;
        return Role::where('role_id',$role_id)->first();
    }
    public function permisstionEvent()
    {
        return $this->hasMany('App\Models\UserPermission','user_id');
    }

    public function module(){
         return $this->belongsToMany('App\Models\module','role_permission','user_id','module_id');
    }
    public function module_event(){
         return $this->belongsToMany('App\Models\module_events','role_permission','user_id','module_event_id');
    }

    public function canModule($val)
    {


        return $this->module->where('slug',$val)->count();
        //return UserPermission::where('user_id',$this->user_id)->where('module_id',$id)->count();
    }
    public function canEvent($val)
    {
        $res=$this->getrole()->module_event->where('event_name',$val)->where('status','!=',0)->first();
        //return $this->getrole()->module_event;
        if($res)
        {
            return true;
        }
        return false;
    }
}

VaKeR 2022