Код: Выделить всё
$blog->getFirstMediaUrl('blog');
Код: Выделить всё
$blogs=Blog::where('publication_status', 1)
->select('id', 'admin_id', 'category_id', 'sub_category_id',
'blog_section_id', 'blog_title', 'slug',
'blog_short_description', 'blog_long_description', 'author_name',
'thumbnail', 'publication_status', 'created_at')
->orderBy('id', 'DESC')
->get();
Cache::forever('blogs', $blogs);
Код: Выделить всё
$media=Media::all(); Cache::forever('media', $media);
Код: Выделить всё
$data['blogs']=cache()-get('blogs', function (){
Blog::where('publication_status', 1)
->select('id', 'admin_id', 'category_id', 'sub_category_id', 'blog_section_id', 'blog_title', 'slug',
'blog_short_description', 'blog_long_description', 'author_name',
'thumbnail', 'publication_status', 'created_at')
->orderBy('id', 'DESC')
->get();
});
return view('Frontend.includes.homepage.homepage', $data);
Код: Выделить всё
[list]
@foreach($blogs
->where('thumbnail', 1)
->where('blog_section_id', 1)
->take(1)
as $main_section)
[*]
[url={{ route(]slug) }}" class="featured_img"> [i] $main_section->getFirstMediaUrl('blog') }}"> [/url]
[url={{ route(]slug) }}">{{ $main_section->blog_title }}[/url]
{{ $main_section->blog_short_description }}
[/i] {{ $main_section->created_at->diffForHumans() }}
@endforeach
[/list]
Код: Выделить всё
$main_section->getFirstMediaUrl('blog');
Подробнее здесь: https://stackoverflow.com/questions/571 ... ry-package
Мобильная версия