Commit 46465ada by Aan Choesni Herlingga

show front index with translation

parent 86720494
......@@ -28,7 +28,7 @@ class HomeController extends Controller
public function changeLocale(Request $request)
{
$language = $request->language ?? 'en';
$language = $request->language == 'en' ? 'en' : 'id';
session(['selected_language' => $language]);
return redirect()->back();
......
<?php
namespace App\Http\Controllers\Webprofile\Front;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Webprofile\Design;
use App\Models\Webprofile\Gallery;
use App\Models\Webprofile\Information;
use App\Models\Webprofile\Menu;
use App\Models\Webprofile\Posts;
use App\Models\Webprofile\Slider;
use Session;
class FrontController extends Controller
{
public function index()
{
$setting = webprofilesetting();
if (!Session::has('selected_language')) {
session(['selected_language' => 'id']);
}
if (Session::get('selected_language') == 'id') {
$data = $this->getDataId($setting);
return view('webprofile.front.' . $setting['theme'] . '.index', $data);
} else if (Session::get('selected_language') == 'en') {
$data = $this->getDataEn($setting);
return view('webprofile.front.' . $setting['theme'] . '.en.index', $data);
}
}
private function getDataId($setting)
{
$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();
$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();
$slider = Slider::where('is_active', '1')->orderby('created_at', 'desc')->get();
$menu = Menu::orderby('urutan', 'asc')->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 = [
'posts' => $posts,
'resend' => $resend,
'hot' => $hot,
'info' => $info,
'slider' => $slider,
'menu' => $menu,
'gallery' => $gallery,
'quote' => $quote,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
'body' => $body,
'setting' => $setting,
];
return $data;
}
private function getDataEn($setting)
{
$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();
$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();
$slider = Slider::where('is_active', '1')->orderby('created_at', 'desc')->get();
$menu = Menu::with(['rEn'])->orderby('urutan', 'asc')->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 = [
'posts' => $posts,
'resend' => $resend,
'hot' => $hot,
'info' => $info,
'slider' => $slider,
'menu' => $menu,
'gallery' => $gallery,
'quote' => $quote,
'widget_right' => $widget_right,
'widget_left' => $widget_left,
'body' => $body,
'setting' => $setting,
];
return $data;
}
}
......@@ -58,6 +58,10 @@ class RouteServiceProvider extends ServiceProvider
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/webprofile/backend.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/webprofile/front.php'));
}
/**
......
......@@ -67,8 +67,8 @@
</li>
<li class="pull-right">
<div style = "padding-top: 15px;">
{!! Form::open(array('url' => route('language'), 'method' => 'POST', 'id' => 'pages', 'files' => true)) !!}
{!! Form::select('language', ['id'=>'Indonesia', 'en'=>'English'], Session::get('selected_language'), ['onChange'=>'this.form.submit();']) !!}
{!! Form::open(array('url' => route('language'), 'method' => 'POST', 'id' => 'pages')) !!}
{!! Form::select('language', ['en'=>'English', 'id'=>'Indonesia'], Session::get('selected_language'), ['onChange'=>'this.form.submit();']) !!}
<button type="submit" style="display: none;">simpan</button>
{!! Form::close() !!}
</div>
......
@foreach ($menu as $value)
@if(!$value->parent)
@if($value->url)
<li><a href="{!! url((string)$value->url) !!}">{!! $value->rEn->name !!}</a></li>
@else
<li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle">{!! $value->rEn->name !!} <div class="arrow-up"></div></a>
<ul class="dropdown-menu" role="menu">
@foreach ($menu as $valuec)
@if($valuec->parent == $value->id)
@if($valuec->url)
<li><a href="{!! url((string)$valuec->url) !!}">{!! $valuec->rEn->name !!}</a></li>
@else
<li class="dropdown-submenu">
<a href="#">{!! $valuec->name !!}</a>
<ul class="dropdown-menu">
@foreach ($menu as $valuec2)
@if($valuec2->parent == $valuec->id)
<li><a href="{!! url((string)$valuec2->url) !!}">{!! $valuec2->rEn->name !!}</a></li>
@endif
@endforeach
</ul>
</li>
@endif
@endif
@endforeach
</ul>
</li>
@endif
@endif
@endforeach
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>{{$setting['web_title']}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<!-- Bootstrap Styles -->
<link href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/css/bootstrap.css" rel="stylesheet">
<style media="screen">
a.navbar-brand {
background: url({!! $setting['logo'] !!}) no-repeat scroll left top rgba(0, 0, 0, 0);
/* height: 55px;
width: auto; */
}
a {
color: #428bca;
text-decoration: none;
background: transparent;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
</style>
<!-- Styles -->
<link rel='stylesheet' type='text/css' href='https://statik.unesa.ac.id/profileunesa_konten_statik/front/css/{!! $setting['style'] !!}' />
<!-- Flex Slider -->
<link href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/css/flexslider.css" rel="stylesheet">
<!-- Carousel Slider -->
<link href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/css/owl-carousel.css" rel="stylesheet">
<!-- CSS Animations -->
<link href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/css/animate.min.css" rel="stylesheet">
<link href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/css/prettyPhoto.css" rel="stylesheet">
<!-- Google Fonts -->
<link href='https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Lato:400,300,400italic,300italic,700,700italic,900' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Exo:400,300,600,500,400italic,700italic,800,900' rel='stylesheet' type='text/css'>
<!-- SLIDER ROYAL CSS SETTINGS -->
<link href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/royalslider/royalslider.css" rel="stylesheet">
<link href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/royalslider/skins/default-inverted/rs-default-inverted.css" rel="stylesheet">
<!-- SLIDER REVOLUTION 4.x CSS SETTINGS -->
<link rel="stylesheet" type="text/css" href="https://statik.unesa.ac.id/profileunesa_konten_statik/front/rs-plugin/css/settings.css" media="screen" />
@yield('assets')
</head>
<body>
<div id="topbar" class="clearfix">
<div class="container">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
<div class="social-icons">
</div><!-- end social icons -->
</div><!-- end columns -->
<div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
<div class="topmenu">
<span class="topbar-cart"><i class="fa fa-globe"></i> <a href="https://www.unesa.ac.id" target="_blank">UNESA</a></span>
<div class="ua-lang pull-right hidden-sm" style="padding-top: 7px;">
{!! Form::open(array('url' => route('language'), 'method' => 'POST', 'style'=>'display:inline', 'id'=>'en')) !!}
<input type="hidden" value="en" name="language">
<a href="javascript:;" onclick="document.getElementById('en').submit();"><img src="https://www.unesa.ac.id/assets2/images/en.png"></a>
{!! Form::close() !!}
{!! Form::open(array('url' => route('language'), 'method' => 'POST', 'style'=>'display:inline', 'id'=>'id')) !!}
<input type="hidden" value="id" name="language">
<a href="javascript:;" onclick="document.getElementById('id').submit();"><img src="https://www.unesa.ac.id/assets2/images/id.png"></a>
{!! Form::close() !!}
</div>
</div><!-- end top menu -->
<div class="callus">
<span class="topbar-email"><i class="fa fa-envelope"></i> <a href="mailto:{!! $setting['email'] !!}">{!! $setting['email'] !!}</a></span>
</div><!-- end callus -->
</div><!-- end columns -->
</div><!-- end container -->
</div><!-- end topbar -->
<header id="header-style-1">
<div class="container">
<nav class="navbar yamm navbar-default">
<div class="navbar-header">
<button type="button" data-toggle="collapse" data-target="#navbar-collapse-1" class="navbar-toggle">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="{!! url("/") !!}" class="navbar-brand">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
</div><!-- end navbar-header -->
<div id="navbar-collapse-1" class="navbar-collapse collapse navbar-right">
<ul class="nav navbar-nav">
@if (Session::get('selected_language') == 'id')
@include('webprofile.front.jollyany.menu')
@endif
@if (Session::get('selected_language') == 'en')
@include('webprofile.front.jollyany.en.menu')
@endif
</ul><!-- end navbar-nav -->
</div><!-- #navbar-collapse-1 -->
</nav><!-- end navbar yamm navbar-default -->
</div><!-- end container -->
</header><!-- end header-style-1 -->
@yield('slider')
@yield('content')
{{-- @yield('footer') --}}
{{-- @include('webprofile.front.footer') --}}
<div id="copyrights">
<div class="container">
<div id="global-footer" style="text-align:center; line-height:15px"><br>
<a href="/"><img src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/images/unesa-bawah.png" alt="Surabaya State University" width="105" height="49"><br>Copyright © {!! Date('Y') !!} {{$setting['web_title']}}. Supported By PPTI Universitas Negeri Surabaya</a>
</div>
</div><!-- end container -->
</div>
<div class="dmtop">Scroll to Top</div>
<!-- Main Scripts-->
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/jquery.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/bootstrap.min.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/menu.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/owl.carousel.min.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/jquery.parallax-1.1.3.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/jquery.simple-text-rotator.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/wow.min.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/jquery.fitvids.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/custom.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/jquery.isotope.min.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/custom-portfolio.js"></script>
<!-- SLIDER REVOLUTION 4.x SCRIPTS -->
<script type="text/javascript" src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/rs-plugin/js/jquery.themepunch.plugins.min.js"></script>
<script type="text/javascript" src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/rs-plugin/js/jquery.themepunch.revolution.min.js"></script>
@yield('scripts')
<script src="https://www.unesa.ac.id/assets/js/jquery.prettyPhoto.js"></script>
<script type="text/javascript">
(function($) {
"use strict";
jQuery('a[data-gal]').each(function() {
jQuery(this).attr('rel', jQuery(this).data('gal'));
});
jQuery("a[data-gal^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',slideshow:false,overlay_gallery: false,theme:'light_square',social_tools:false,deeplinking:false});
})(jQuery);
</script>
<script type="text/javascript">
var revapi;
jQuery(document).ready(function() {
revapi = jQuery('.tp-banner').revolution(
{
delay:9000,
startwidth:1686,
startheight:500,
hideThumbs:10,
fullWidth:"on",
forceFullWidth:"on"
});
}); //ready
</script>
<script>
(function($) {
"use strict";
$(document).ready(function(){
// Target your .container, .wrapper, .post, etc.
$("body").fitVids();
});
})(jQuery);
</script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/js/jquery.flexslider.js"></script>
<script type="text/javascript">
(function($) {
"use strict";
$(window).load(function(){
$('.flexslider').flexslider({
animation: "fade",
controlNav: false,
start: function(slider){
$('body').removeClass('loading');
}
});
});
})(jQuery);
</script>
<!-- Demo Switcher JS -->
<script type="text/javascript" src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/switcher/js/fswit.js"></script>
<script src="https://statik.unesa.ac.id/profileunesa_konten_statik/front/switcher/js/bootstrap-select.js"></script>
</body>
</html>
@foreach ($menu as $value)
@if(!$value->parent)
@if($value->url)
<li><a href="{!! url((string)$value->url) !!}">{!! $value->name !!}</a></li>
@else
<li class="dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle">{!! $value->name !!} <div class="arrow-up"></div></a>
<ul class="dropdown-menu" role="menu">
@foreach ($menu as $valuec)
@if($valuec->parent == $value->id)
@if($valuec->url)
<li><a href="{!! url((string)$valuec->url) !!}">{!! $valuec->name !!}</a></li>
@else
<li class="dropdown-submenu">
<a href="#">{!! $valuec->name !!}</a>
<ul class="dropdown-menu">
@foreach ($menu as $valuec2)
@if($valuec2->parent == $valuec->id)
<li><a href="{!! url((string)$valuec2->url) !!}">{!! $valuec2->name !!}</a></li>
@endif
@endforeach
</ul>
</li>
@endif
@endif
@endforeach
</ul>
</li>
@endif
@endif
@endforeach
......@@ -11,10 +11,6 @@
|
*/
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::post('/change-language', 'HomeController@changeLocale')->name('language');
......
<?php
Route::group(['namespace' => 'Webprofile\Front'], function () {
Route::get('/', 'FrontController@index');
Route::get('page/{id}', 'FrontController@page')->name('page');
Route::get('post/{id}', 'FrontController@post')->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');
Route::get('agenda', 'FrontController@agenda')->name('agenda');
Route::get('error', 'FrontController@error')->name('error');
Route::get('download', 'FrontController@download')->name('download');
Route::get('downloadlink/{data}', 'FrontController@downloadFile')->name('downloadFile');
});
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