public function searchUser($searchTerm, $page = 1, $limit = 10)
    {
        $total = $this->userRepository->countNumberOfUserInSearch($searchTerm);

        $users = $this->userRepository->searchUsers($searchTerm, $page, $limit);

        $results = [];

        foreach ($users as $user) {
            $results[] = $user->listView();
        }

        return new PageModel($results, $page, $total, $limit, 'users');
    }
public function searchUser($searchTerm, $page = 1, $limit = 10)
    {
        $total = $this->userRepository->countNumberOfUserInSearch($searchTerm);

        $users = $this->userRepository->searchUsers($searchTerm, $page, $limit);

        $results = [];

        foreach ($users as $user) {
            $results[] = $user->listView();
        }

        return new PageModel($results, $page, $total, $limit, 'users');
    }
public function searchUser ( $ searchTerm , $ page = 1 , $ limit = 10 ) { $ total = $ this -> userRepository -> countNumberOfUserInSearch ( $ searchTerm ) ; $ users = $ this -> userRepository -> searchUsers ( $ searchTerm , $ page , $ limit ) ; $ results = [ ] ; foreach ( $ users as $ user ) { $ results [ ] = $ user -> listView ( ) ; } return new PageModel ( $ results , $ page , $ total , $ limit , 'users' ) ; }
Return a paginator of users

@param $searchTerm
@param int $page
@param int $limit
@return PageModel
Return a paginator of users