<div id="media" style="padding-bottom:30px;">

	<?php 
        $total = DB::table('media')->count();
        $page = config('view.numPage');
    	foreach($images as $item): ?>

		<div class="item_larger animated single-left col-xs-12 col-sm-6 col-md-4" data-id="">
			<div class="item" id="<?= $item->id ?>">
				<input type="hidden" name="_token" value="{{ csrf_token() }}">
				<a href="<?= route('downloadpage', $item->id) ?>" class="head_item item_ajax">
					<div class="dim"></div>
					<img src="{{ config('view.filepath') }}thumb/<?= $item->name ?>">
				</a>
				<a class="content_item" href="<?= route('downloadpage', $item->id) ?>">
					<h3><?= strtoupper($item->title) ?></h3>
					<span class="the-date"><?= date("F j, Y", strtotime($item->created_at)) ?></span>
				</a>
				<div class="item_info">
					<a href="javascript:void(0);" class="buttonlike" align="right" image-id="<?= $item->id ?>"><img src="{{ config('view.rootpath') }}img/icon_like.png"> <b id="id<?= $item->id ?>"><?= $item->count_like ?></b></a>
					<a href="<?= route('downloadpage', $item->id) ?>" class="download" align="right"><img src="{{ config('view.rootpath') }}img/icon_download.png"> <?= $item->count_download ?></a>
				</div>
			</div>
		</div>
	<?php endforeach; ?>
	<script type="text/javascript">
	    jQuery(document).ready(function($){
	        /*setTimeout(function(){
	            $(".Productloader").css('display','none');
	        }, 1000);*/
	        //loadmore

	        var pageNumber = 2;
	        var total = '<?= $total ?>';
	        var page = '<?= $page ?>';
	        $(".load_more").click(function() {
	            $("#showloadmore").hide();   
	            $("#loading").show();   

	            $.ajax
	            ({
	                type: "GET",
	                url: "/loadmore/" + pageNumber,
	                success: function(msg)
	                {
	                    $('#media').append(msg);
	                    $("#showloadmore").show(); 
	                    $("#loading").hide();
	                    if ((pageNumber *page)-1 > total) {
	                        $("#showloadmore").hide(); 
	                    } else {
	                        pageNumber += 1;
	                    }
	                }
	            });
	        });
	        //end loadmore
	    });
	</script>
</div>