Pagination not Working on only Front page on latest verson of WordPress

this is proper working code for pagination on forntpage

if ( get_query_var(‘paged’) ) {

            $paged = get_query_var('paged');

        } elseif ( get_query_var('page') ) {

            $paged = get_query_var('page');

        } else {

            $paged = 1;

        }

        $args = array( 
                  'post_type' => 'post', 
                  'posts_per_page' => 8, 
                  'post_status'   => 'publish',
                  'paged'          => $paged
         );
        $loop = new WP_Query( $args );
        while ( $loop->have_posts() ) : $loop->the_post();
         the_title(); the_content();
        endwhile;

and pagination code here

$big = 999999999; // need an unlikely integer

        echo paginate_links( array(
          'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
          'format' => '?paged=%#%',
          'current' => max( 1, get_query_var('page') ),
          'total' => $loop->max_num_pages
        ) );