private function fetchEntries()
    {
        // query to get the products
        //$items = User::orderBy('firstname')->get();
        $items = User::whereRole(Role::$USER)->orderBy('firstname')->get();

        $total = $items->count();
        // if filtered
        if (session('filtered')) {
            // filter entries on the filter criteria
            $client = session('filter_fullname', '');
            if (strlen($client) >= 2) {
                $items = $items->filter(function ($item) use ($client) {
                    return (stristr($item->fullname, $client) !== false);
                });
            }

            $cellphone = session('filter_cellphone', '');
            if (strlen($cellphone) >= 2) {
                $items = $items->filter(function ($item) use ($cellphone) {
                    return (stristr($item->cellphone, $cellphone) !== false);
                });
            }

            $email = session('filter_email', '');
            if (strlen($email) >= 2) {
                $items = $items->filter(function ($item) use ($email) {
                    return (stristr($item->email, $email) !== false);
                });
            }
        }

        return ['items' => $items, 'total' => $total];
    }
private function fetchEntries()
    {
        // query to get the products
        //$items = User::orderBy('firstname')->get();
        $items = User::whereRole(Role::$USER)->orderBy('firstname')->get();

        $total = $items->count();
        // if filtered
        if (session('filtered')) {
            // filter entries on the filter criteria
            $client = session('filter_fullname', '');
            if (strlen($client) >= 2) {
                $items = $items->filter(function ($item) use ($client) {
                    return (stristr($item->fullname, $client) !== false);
                });
            }

            $cellphone = session('filter_cellphone', '');
            if (strlen($cellphone) >= 2) {
                $items = $items->filter(function ($item) use ($cellphone) {
                    return (stristr($item->cellphone, $cellphone) !== false);
                });
            }

            $email = session('filter_email', '');
            if (strlen($email) >= 2) {
                $items = $items->filter(function ($item) use ($email) {
                    return (stristr($item->email, $email) !== false);
                });
            }
        }

        return ['items' => $items, 'total' => $total];
    }
private function fetchEntries ( ) { // query to get the products //$items = User::orderBy('firstname')->get(); $ items = User :: whereRole ( Role :: $ USER ) -> orderBy ( 'firstname' ) -> get ( ) ; $ total = $ items -> count ( ) ; // if filtered if ( session ( 'filtered' ) ) { // filter entries on the filter criteria $ client = session ( 'filter_fullname' , '' ) ; if ( strlen ( $ client ) >= 2 ) { $ items = $ items -> filter ( function ( $ item ) use ( $ client ) { return ( stristr ( $ item -> fullname , $ client ) !== false ) ; } ) ; } $ cellphone = session ( 'filter_cellphone' , '' ) ; if ( strlen ( $ cellphone ) >= 2 ) { $ items = $ items -> filter ( function ( $ item ) use ( $ cellphone ) { return ( stristr ( $ item -> cellphone , $ cellphone ) !== false ) ; } ) ; } $ email = session ( 'filter_email' , '' ) ; if ( strlen ( $ email ) >= 2 ) { $ items = $ items -> filter ( function ( $ item ) use ( $ email ) { return ( stristr ( $ item -> email , $ email ) !== false ) ; } ) ; } } return [ 'items' => $ items , 'total' => $ total ] ; }
Fetch the users
Fetch the users