Пример #1
0
<?php

use Strimoid\Models\Entry;
$builder = Entry::with('user')->fromDaysAgo(3);
if (isset($group) && $group instanceof Strimoid\Models\Group) {
    $builder->where('group_id', $group->getKey());
}
$popularEntries = $builder->remember(60)->orderBy('uv', 'desc')->take(5)->get();
?>

<div class="well popular_contents_widget">
    <h5>@lang('common.recently popular')</h5>

    <ul class="media-list popular_contents_list">
        @foreach ($popularEntries as $entry)
        <?php 
$text = preg_replace('/<a class="show_spoiler">(.*?)<\\/a>/s', '', $entry->text);
$text = preg_replace('/<span class="spoiler">(.*?)<\\/span>/s', '', $text);
$text = strip_tags($text);
?>
        <li class="media">
            <a class="pull-left" href="{!! route('single_entry', $entry) !!}">
                <img src="{!! $entry->user->getAvatarPath(40, 40) !!}" alt="{!! $entry->user->name !!}"
                     style="height: 40px; width: 40px; border-radius: 3px;">
            </a>
            <div class="media-body">
                <h6 class="media-heading">
                    <a href="{!! route('single_entry', $entry) !!}">{!! Str::limit($text, 100) !!}</a>
                </h6>
                <small>
                    <i class="fa fa-thumbs-up"></i> {{ $entry->uv }}</a>