This commit is contained in:
= 2021-06-18 17:43:14 +05:00
commit 6eb3850bef
3 changed files with 18 additions and 3 deletions

View File

@ -31,14 +31,23 @@ class postsController extends Controller
'category' => input('category'),
'date' => input('date'),
'published' => true,
'select' => ['id','title','published_at',DB::raw("IF(featured_image<>'',concat('$path',featured_image),featured_image) as main_image")]
'select' => ['id','title','slug','published_at',DB::raw("IF(featured_image<>'',concat('$path',featured_image),featured_image) as main_image")]
]);
if($data){
$data->each(function ($item, $key) {
$item->url = $this->pageUrl('post',['id'=>$item->id,'slug'=>$item->slug]);
});
}
return $this->helpers->apiArrayResponseBuilder(200, 'success', $data);
}
public function show($locale,$id){
$post = $this->Post::find($id,['id','content_html','author']);
$post = $this->Post::find($id,['id','content_html','author','slug']);
$post->url = $this->pageUrl('post',['id'=>$post->id,'slug'=>$post->slug]);
if(!is_null($post)) {
$obj = Db::table('vdomah_blogviews_views')

View File

@ -66,6 +66,11 @@ class CmsPage extends ComponentBase
} else { //todo els if has category component
$this->hasBlog = $this->page["hasBlog"] = true;
if($this->page->page->hasComponent("blogPosts")){
$this->seo_title = $this->page["seo_title"] = empty($this->page->meta_title) ? $this->page->title : $this->page->meta_title;
dd($this->page->page);
}
}
}

View File

@ -19,7 +19,8 @@ $(".swiper-wrapper").slick({
slidesToScroll: 1,
arrows: true,
infinite: true,
autoplay: true,
speed: 500,
prevArrow: $(".p3"),
nextArrow: $(".n3"),
});