MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/www/imenso.co/dev/acca/app/User.php
<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Zizaco\Entrust\Traits\EntrustUserTrait;
class User extends Authenticatable
{
    use EntrustUserTrait; // add this trait to your user model
    use Notifiable;


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

    /**
     * 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 case_tasks()
    {
        return $this->belongsToMany(App\Models\Case_task::class, 'case_task_users');
    }

    public static function getUsers()
    {
        $users = User::
            join('role_user','role_user.user_id','=','users.id')
            ->join('roles','roles.id','=','role_user.role_id')
            ->select('users.*','roles.name as role_name') ;
        if( isset(request()->searchRoleId))
        {
            $users = $users->where('role_user.role_id',request()->searchRoleId );
        }
        if( isset(request()->searchName))
        {
            $users = $users->where('users.name',request()->searchName );
        }
        $users = $users->groupBy('users.id')->orderBy('users.id', 'DESC')
        ->get();
        return $users ;
    }  
}