Commit bab1d640 by Aan Choesni Herlingga

berita terkait

parent 4c0f6f0e
...@@ -34,6 +34,7 @@ class PostController extends Controller ...@@ -34,6 +34,7 @@ class PostController extends Controller
{ {
$setting = webprofilesetting(); $setting = webprofilesetting();
$data = Posts::where('slug', $title)->first(); $data = Posts::where('slug', $title)->first();
$terkait = Posts::where('categories', $data->categories)->orderBy('created_at', 'desc')->limit('5')->get();
$resend = Posts::where('post_status', '1')->orderby('post_date', 'desc')->limit('5')->get(); $resend = Posts::where('post_status', '1')->orderby('post_date', 'desc')->limit('5')->get();
$hot = Posts::where('post_status', '1')->orderby('viewer', 'desc')->limit('5')->get(); $hot = Posts::where('post_status', '1')->orderby('viewer', 'desc')->limit('5')->get();
$categories = Categories::where('is_active', '1')->get(); $categories = Categories::where('is_active', '1')->get();
...@@ -48,6 +49,7 @@ class PostController extends Controller ...@@ -48,6 +49,7 @@ class PostController extends Controller
$data = [ $data = [
'setting' => $setting, 'setting' => $setting,
'data' => $data, 'data' => $data,
'terkait' => $terkait,
'menu' => $menu, 'menu' => $menu,
'widget_right' => $widget_right, 'widget_right' => $widget_right,
'widget_left' => $widget_left, 'widget_left' => $widget_left,
...@@ -64,6 +66,7 @@ class PostController extends Controller ...@@ -64,6 +66,7 @@ class PostController extends Controller
{ {
$setting = webprofilesetting(); $setting = webprofilesetting();
$data = Posts::with(['rEn'])->where('slug', $title)->first(); $data = Posts::with(['rEn'])->where('slug', $title)->first();
$terkait = Posts::with(['rEn'])->where('categories', $data->categories)->orderBy('created_at', 'desc')->limit('4')->get();
$resend = Posts::with(['rEn'])->where('post_status', '1')->orderby('post_date', 'desc')->limit('5')->get(); $resend = Posts::with(['rEn'])->where('post_status', '1')->orderby('post_date', 'desc')->limit('5')->get();
$hot = Posts::with(['rEn'])->where('post_status', '1')->orderby('viewer', 'desc')->limit('5')->get(); $hot = Posts::with(['rEn'])->where('post_status', '1')->orderby('viewer', 'desc')->limit('5')->get();
$categories = Categories::with(['rEn'])->where('is_active', '1')->get(); $categories = Categories::with(['rEn'])->where('is_active', '1')->get();
...@@ -78,6 +81,7 @@ class PostController extends Controller ...@@ -78,6 +81,7 @@ class PostController extends Controller
$data = [ $data = [
'setting' => $setting, 'setting' => $setting,
'data' => $data, 'data' => $data,
'terkait' => $terkait,
'menu' => $menu, 'menu' => $menu,
'widget_right' => $widget_right, 'widget_right' => $widget_right,
'widget_left' => $widget_left, 'widget_left' => $widget_left,
......
...@@ -38,6 +38,19 @@ ...@@ -38,6 +38,19 @@
</center> </center>
@endif @endif
@endif @endif
<br>
<div class="widget col-md-4 pull-right related hidden-sm hidden-xs kaitan" style="margin-bottom: 5px;">
<h4 class="h4_kaitan"><strong>berita terkait </strong></h4>
<div class="isi_kaitan">
<div class="content_kaitan">
<ul class="ul_kaitan nav nav-tabs nav-stacked">
@foreach($terkait as $valTerkait)
<li><strong><a title="{!! $valTerkait->rEn->title !!}" href="{!! url('post/'.$valTerkait->slug) !!}">{!! $valTerkait->rEn->title !!}</a></strong></li>
@endforeach
</ul>
</div>
</div>
</div>
{!! $data->rEn->content !!} {!! $data->rEn->content !!}
</div> </div>
</div> </div>
......
...@@ -45,6 +45,19 @@ ...@@ -45,6 +45,19 @@
</center> </center>
@endif @endif
@endif @endif
<br>
<div class="widget col-md-4 pull-right related hidden-sm hidden-xs kaitan" style="margin-bottom: 5px;">
<h4 class="h4_kaitan"><strong>berita terkait </strong></h4>
<div class="isi_kaitan">
<div class="content_kaitan">
<ul class="ul_kaitan nav nav-tabs nav-stacked">
@foreach($terkait as $valTerkait)
<li><strong><a title="{!! $valTerkait->title !!}" href="{!! url('post/'.$valTerkait->slug) !!}">{!! $valTerkait->title !!}</a></strong></li>
@endforeach
</ul>
</div>
</div>
</div>
{!! $data->content !!} {!! $data->content !!}
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment