Commit 9d3db05f by Aan Choesni Herlingga

front page

parent fad2715d
...@@ -64,6 +64,7 @@ class PageController extends Controller ...@@ -64,6 +64,7 @@ class PageController extends Controller
public function store(Request $request) public function store(Request $request)
{ {
$data = $request->except('_token'); $data = $request->except('_token');
$data['slug'] = str_slug($request->input('title'));
$save = $this->repo->store($data); $save = $this->repo->store($data);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace App\Http\Controllers\Webprofile\Front; namespace App\Http\Controllers\Webprofile\Front;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Webprofile\Design; use App\Models\Webprofile\Design;
use App\Models\Webprofile\Gallery; use App\Models\Webprofile\Gallery;
...@@ -33,38 +32,31 @@ class FrontController extends Controller ...@@ -33,38 +32,31 @@ class FrontController extends Controller
private function getDataId($setting) private function getDataId($setting)
{ {
$posts = Posts::where('post_status', '1')->orderby('post_date', 'desc')->paginate($setting['post_per_page']); $posts = Posts::where('post_status', '1')->orderby('post_date', 'desc')->paginate($setting['post_per_page']);
$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();
$info = Information::where('info_status', '1')->where('event_date', '>=', Date('Y-m-d'))->orderby('event_date', 'asc')->get();
$hot = Posts::where('post_status', '1')->orderby('viewer', 'desc')->limit('5')->get(); $slider = Slider::where('is_active', '1')->orderby('created_at', 'desc')->get();
$menu = Menu::orderby('urutan', 'asc')->get();
$info = Information::where('info_status', '1')->where('event_date', '>=', Date('Y-m-d'))->orderby('event_date', 'asc')->get(); $gallery = Gallery::where('is_active', '1')->orderBy('created_at', 'asc')->limit('4')->get();
$quote = Design::where('name_design', 'quote')->get();
$slider = Slider::where('is_active', '1')->orderby('created_at', 'desc')->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();
$menu = Menu::orderby('urutan', 'asc')->get(); $body = Design::where('name_design', 'body')->get();
$gallery = Gallery::where('is_active', '1')->orderBy('created_at', 'asc')->limit('4')->get();
$quote = Design::where('name_design', 'quote')->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();
$body = Design::where('name_design', 'body')->get();
$data = [ $data = [
'posts' => $posts, 'posts' => $posts,
'resend' => $resend, 'resend' => $resend,
'hot' => $hot, 'hot' => $hot,
'info' => $info, 'info' => $info,
'slider' => $slider, 'slider' => $slider,
'menu' => $menu, 'menu' => $menu,
'gallery' => $gallery, 'gallery' => $gallery,
'quote' => $quote, 'quote' => $quote,
'widget_right' => $widget_right, 'widget_right' => $widget_right,
'widget_left' => $widget_left, 'widget_left' => $widget_left,
'body' => $body, 'body' => $body,
'setting' => $setting, 'setting' => $setting,
]; ];
return $data; return $data;
...@@ -72,38 +64,31 @@ class FrontController extends Controller ...@@ -72,38 +64,31 @@ class FrontController extends Controller
private function getDataEn($setting) private function getDataEn($setting)
{ {
$posts = Posts::with(['rEn'])->where('post_status', '1')->orderby('post_date', 'desc')->paginate($setting['post_per_page']); $posts = Posts::with(['rEn'])->where('post_status', '1')->orderby('post_date', 'desc')->paginate($setting['post_per_page']);
$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();
$info = Information::with(['rEn'])->where('info_status', '1')->where('event_date', '>=', Date('Y-m-d'))->orderby('event_date', 'asc')->get();
$hot = Posts::with(['rEn'])->where('post_status', '1')->orderby('viewer', 'desc')->limit('5')->get(); $slider = Slider::where('is_active', '1')->orderby('created_at', 'desc')->get();
$menu = Menu::with(['rEn'])->orderby('urutan', 'asc')->get();
$info = Information::with(['rEn'])->where('info_status', '1')->where('event_date', '>=', Date('Y-m-d'))->orderby('event_date', 'asc')->get(); $gallery = Gallery::where('is_active', '1')->orderBy('created_at', 'asc')->limit('4')->get();
$quote = Design::where('name_design', 'quote')->get();
$slider = Slider::where('is_active', '1')->orderby('created_at', 'desc')->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();
$menu = Menu::with(['rEn'])->orderby('urutan', 'asc')->get(); $body = Design::where('name_design', 'body')->get();
$gallery = Gallery::where('is_active', '1')->orderBy('created_at', 'asc')->limit('4')->get();
$quote = Design::where('name_design', 'quote')->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();
$body = Design::where('name_design', 'body')->get();
$data = [ $data = [
'posts' => $posts, 'posts' => $posts,
'resend' => $resend, 'resend' => $resend,
'hot' => $hot, 'hot' => $hot,
'info' => $info, 'info' => $info,
'slider' => $slider, 'slider' => $slider,
'menu' => $menu, 'menu' => $menu,
'gallery' => $gallery, 'gallery' => $gallery,
'quote' => $quote, 'quote' => $quote,
'widget_right' => $widget_right, 'widget_right' => $widget_right,
'widget_left' => $widget_left, 'widget_left' => $widget_left,
'body' => $body, 'body' => $body,
'setting' => $setting, 'setting' => $setting,
]; ];
return $data; return $data;
......
<?php
namespace App\Http\Controllers\Webprofile\Front;
use App\Http\Controllers\Controller;
use App\Models\Webprofile\Design;
use App\Models\Webprofile\Menu;
use App\Models\Webprofile\Pages;
use Session;
class PageController 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'] . '.page', $data);
} else if (Session::get('selected_language') == 'en') {
$data = $this->getDataEn($setting, $title);
return view('webprofile.front.' . $setting['theme'] . '.en.page', $data);
}
}
public function getDataId($setting, $title)
{
$setting = webprofilesetting();
$data = Pages::where('slug', $title)->first();
$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();
$data = [
'setting' => $setting,
'data' => $data,
'menu' => $menu,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
];
return $data;
}
public function getDataEn($setting, $title)
{
$setting = webprofilesetting();
$data = Pages::with(['rEn'])->where('slug', $title)->first();
$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();
$data = [
'setting' => $setting,
'data' => $data,
'menu' => $menu,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
];
return $data;
}
}
...@@ -73,4 +73,19 @@ abstract class Repository ...@@ -73,4 +73,19 @@ abstract class Repository
{ {
return $model->delete(); return $model->delete();
} }
public function upload($name, $request, $tipe, $setting)
{
if ($request->hasFile($tipe)) {
$cover = $request->file($tipe);
$extension = $cover->guessClientExtension();
$filename = $name . '.' . $extension;
if ($setting['external_storage'] == 1) {
Storage::disk('storage')->put($setting['directory'] . '/' . $tipe . '/' . $filename, file_get_contents($cover->getRealPath()));
} else {
Storage::disk('local')->put('public/' . $tipe . '/' . $filename, file_get_contents($cover->getRealPath()));
}
return $filename;
}
}
} }
@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-md-12" role="main" align="justify">
{!! $data->rEn->content !!}
</div>
</div>
</div><!-- end title -->
</div><!-- end container -->
</section><!--end white-wrapper -->
@endsection
@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-md-12" role="main" align="justify">
{!! $data->content !!}
</div>
</div>
</div><!-- end title -->
</div><!-- end container -->
</section><!--end white-wrapper -->
@endsection
<?php <?php
Route::group(['namespace' => 'Webprofile\Front'], function () { Route::group(['namespace' => 'Webprofile\Front'], function () {
Route::get('/', 'FrontController@index'); Route::get('/', 'FrontController@index');
Route::get('page/{id}', 'FrontController@page')->name('page'); Route::get('page/{id}', 'PageController@index')->name('page');
Route::get('post/{id}', 'FrontController@post')->name('post'); Route::get('post/{id}', 'FrontController@post')->name('post');
Route::get('archive', 'FrontController@archive')->name('archive'); Route::get('archive', 'FrontController@archive')->name('archive');
Route::get('category/{id}','FrontController@category')->name('category'); Route::get('category/{id}','FrontController@category')->name('category');
......
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