app/Http/Controllers/UsersController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $statusCodes = DB::table('statusCodes')
                    ->Where('code', '=', 136)
                    ->orWhere('code', '=', 137)
                    ->get();
        $clients = DB::table('clients')->get();
        $userGroups = DB::table('user_groups')->get();
        $users = DB::table('users')
                ->join('clients', 'clients.clientID', '=', 'users.clientID')
                ->join('statusCodes', 'statusCodes.code', '=', 'users.status')
                ->join('user_groups', 'user_groups.id', '=', 'users.userGroup')
                ->select('users.*', 'clients.clientName', 'user_groups.name', 'statusCodes.description')
                ->Paginate(6);
        return view('users.index', compact('users','clients','userGroups','statusCodes'));
    }
public function index ( ) { $ statusCodes = DB :: table ( 'statusCodes' ) -> Where ( 'code' , '=' , 136 ) -> orWhere ( 'code' , '=' , 137 ) -> get ( ) ; $ clients = DB :: table ( 'clients' ) -> get ( ) ; $ userGroups = DB :: table ( 'user_groups' ) -> get ( ) ; $ users = DB :: table ( 'users' ) -> join ( 'clients' , 'clients.clientID' , '=' , 'users.clientID' ) -> join ( 'statusCodes' , 'statusCodes.code' , '=' , 'users.status' ) -> join ( 'user_groups' , 'user_groups.id' , '=' , 'users.userGroup' ) -> select ( 'users.*' , 'clients.clientName' , 'user_groups.name' , 'statusCodes.description' ) -> Paginate ( 6 ) ; return view ( 'users.index' , compact ( 'users' , 'clients' , 'userGroups' , 'statusCodes' ) ) ; }
Display a listing of the resource.
Display a listing of the resource .
//$statusCodes = DB::table('statusCodes')->get(); // get all clients from db // get all user groups from db // get all users from db //return view('clients.index', ['statusCodes' => $statusCodes]);