Commit 44f6f30d by Aan Choesni Herlingga

front post

parent c9fa7794
......@@ -49,7 +49,7 @@ class PageController extends Controller
{
$setting = webprofilesetting();
$data = Pages::with(['rEn'])->where('slug', $title)->first();
$menu = Menu::orderby('urutan', 'asc')->get();
$menu = Menu::with(['rEn'])->orderby('urutan', 'asc')->get();
$widget_right = Design::where('name_design', 'widget_right')->orderBy('urutan', 'ASC')->get();
$widget_left = Design::where('name_design', 'widget_left')->orderBy('urutan', 'ASC')->get();
......
<?php
namespace App\Http\Controllers\Webprofile\Front;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Webprofile\Categories;
use App\Models\Webprofile\Design;
use App\Models\Webprofile\Menu;
use App\Models\Webprofile\Posts;
use Session;
class PostController extends Controller
{
public function index($title)
{
$setting = webprofilesetting();
if (!Session::has('selected_language')) {
session(['selected_language' => 'id']);
}
if (Session::get('selected_language') == 'id') {
$data = $this->getDataId($setting, $title);
return view('webprofile.front.' . $setting['theme'] . '.post', $data);
} else if (Session::get('selected_language') == 'en') {
$data = $this->getDataEn($setting, $title);
return view('webprofile.front.' . $setting['theme'] . '.en.post', $data);
}
}
public function getDataId($setting, $title)
{
$setting = webprofilesetting();
$data = Posts::where('slug', $title)->first();
$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();
$categories = Categories::where('is_active', '1')->get();
$menu = Menu::orderby('urutan', 'asc')->get();
$widget_right = Design::where('name_design', 'widget_right')->orderBy('urutan', 'ASC')->get();
$widget_left = Design::where('name_design', 'widget_left')->orderBy('urutan', 'ASC')->get();
$viewer['viewer'] = (int)$data->viewer + 1;
$data->update($viewer);
$data = [
'setting' => $setting,
'data' => $data,
'menu' => $menu,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
'resend' => $resend,
'hot' => $hot,
'categories' => $categories,
];
return $data;
}
public function getDataEn($setting, $title)
{
$setting = webprofilesetting();
$data = Posts::with(['rEn'])->where('slug', $title)->first();
$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();
$categories = Categories::with(['rEn'])->where('is_active', '1')->get();
$menu = Menu::with(['rEn'])->orderby('urutan', 'asc')->get();
$widget_right = Design::where('name_design', 'widget_right')->orderBy('urutan', 'ASC')->get();
$widget_left = Design::where('name_design', 'widget_left')->orderBy('urutan', 'ASC')->get();
$viewer['viewer'] = (int) $data->viewer + 1;
$data->update($viewer);
$data = [
'setting' => $setting,
'data' => $data,
'menu' => $menu,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
'resend' => $resend,
'hot' => $hot,
'categories' => $categories,
];
return $data;
}
}
@extends('webprofile.front.jollyany.master')
@section('content')
<section class="post-wrapper-top jt-shadow clearfix">
<div class="container">
<div class="col-lg-12">
<h2>{!! $data->rEn->title !!}</h2>
</div>
</div>
</section><!-- end post-wrapper-top -->
<section class="blog-wrapper">
<div class="container">
<div class="row">
<div id="main-content" class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
<div class="row">
<div class="blog-masonry">
<div class="col-lg-12">
<div class="blog-carousel">
<div class="blog-carousel-header">
<h1>{!! $data->rEn->title !!}</h1>
<div class="blog-carousel-meta">
<span><i class="fa fa-calendar"></i>
<time title="{!! $data->post_data !!}" datetime="{!! $data->post_data !!}">{!! InseoHelper::tglbulanindo2($data->post_date) !!}</time> - kategori <a href="#">{!! $data->rCategory->rEn->name !!}</a></span>
<span><i class="fa fa-eye"></i> <a href="#">{!! $data->viewer !!} Views</a></span>
{{-- <span><i class="fa fa-user"></i> <a href="#">Redaksi</a></span> --}}
</div><!-- end blog-carousel-meta -->
</div><!-- end blog-carousel-header -->
<div class="blog-carousel-desc">
@if ($data->thumbnail)
@if($data->cover_status == 1)
<center>
@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $data->thumbnail }}" alt="" style="max-width:708px">
@else
<img src="{{ url('/storage/thumbnail/' . $data->thumbnail) }}" alt="" style="max-width:708px">
@endif
</center>
@endif
@endif
{!! $data->rEn->content !!}
</div>
</div>
</div>
</div>
</div>
</div>
@include('webprofile.front.jollyany.en.widget')
</div>
</div><!-- end container -->
</section><!--end white-wrapper -->
@endsection
<div id="sidebar" class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div class="widget">
<div class="title"><h2>
<h2>Category</h2>
<ul class="nav nav-tabs nav-stacked">
@foreach($categories as $value)
<li><a class="unesa-link" href="{!! url('category/'.$value->name) !!}">{!! $value->rEn->name !!}</a></li>
@endforeach
</ul>
<h2>latest article</h2>
<ul class="nav nav-tabs nav-stacked">
@foreach($hot as $value)
<li><a class="unesa-link" href="{!! url('post/'.$value->slug) !!}">{!! $value->rEn->title !!}</a></li>
@endforeach
</ul>
@foreach ($widget_right as $vwidget_right)
<div class="widget">
<div class="title">
<h2>{!! $vwidget_right->title_design !!}</h2>
</div><!-- end title -->
{!! $vwidget_right->value_design !!}
</div><!-- end widget -->
@endforeach
</div>
</div>
</div>
@extends('webprofile.front.jollyany.master')
@section('content')
<section class="post-wrapper-top jt-shadow clearfix">
<div class="container">
<div class="col-lg-12">
<h2>{!! $data->title !!}</h2>
</div>
</div>
</section><!-- end post-wrapper-top -->
<section class="blog-wrapper">
<div class="container">
<div class="row">
<div id="main-content" class="col-lg-8 col-md-8 col-sm-12 col-xs-12">
<div class="row">
<div class="blog-masonry">
<div class="col-lg-12">
<div class="blog-carousel">
<div class="blog-carousel-header">
<h1>{!! $data->title !!}</h1>
<div class="blog-carousel-meta">
<span><i class="fa fa-calendar"></i>
<time title="{!! $data->post_data !!}" datetime="{!! $data->post_data !!}">{!! InseoHelper::tglbulanindo2($data->post_date) !!}</time> - kategori <a href="#">{!! $data->rCategory->name !!}</a></span>
<span><i class="fa fa-eye"></i> <a href="#">{!! $data->viewer !!} Views</a></span>
{{-- <span><i class="fa fa-user"></i> <a href="#">Redaksi</a></span> --}}
</div><!-- end blog-carousel-meta -->
</div><!-- end blog-carousel-header -->
<div class="blog-carousel-desc">
@if ($data->thumbnail)
@if($data->cover_status == 1)
<center>
@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $data->thumbnail }}" alt="" style="max-width:708px">
@else
<img src="{{ url('/storage/thumbnail/' . $data->thumbnail) }}" alt="" style="max-width:708px">
@endif
</center>
@endif
@endif
{!! $data->content !!}
</div>
</div>
</div>
</div>
</div>
</div>
@include('webprofile.front.jollyany.widget')
</div>
</div><!-- end container -->
</section><!--end white-wrapper -->
@endsection
<div id="sidebar" class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
<div class="widget">
<div class="title"><h2>
<h2>kategori</h2>
<ul class="nav nav-tabs nav-stacked">
@foreach($categories as $value)
<li><a class="unesa-link" href="{!! url('category/'.$value->name) !!}">{!! $value->name !!}</a></li>
@endforeach
</ul>
<h2>artikel terkini</h2>
<ul class="nav nav-tabs nav-stacked">
@foreach($hot as $value)
<li><a class="unesa-link" href="{!! url('post/'.$value->slug) !!}">{!! $value->title !!}</a></li>
@endforeach
</ul>
@foreach ($widget_right as $vwidget_right)
<div class="widget">
<div class="title">
<h2>{!! $vwidget_right->title_design !!}</h2>
</div><!-- end title -->
{!! $vwidget_right->value_design !!}
</div><!-- end widget -->
@endforeach
</div>
</div>
</div>
......@@ -2,7 +2,7 @@
Route::group(['namespace' => 'Webprofile\Front'], function () {
Route::get('/', 'FrontController@index');
Route::get('page/{id}', 'PageController@index')->name('page');
Route::get('post/{id}', 'FrontController@post')->name('post');
Route::get('post/{id}', 'PostController@index')->name('post');
Route::get('archive', 'FrontController@archive')->name('archive');
Route::get('category/{id}','FrontController@category')->name('category');
Route::get('info/{id}', 'FrontController@info')->name('infomation');
......
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