Commit fad2715d by Aan Choesni Herlingga

show front image

parent 46465ada
...@@ -68,8 +68,7 @@ class PostController extends Controller ...@@ -68,8 +68,7 @@ class PostController extends Controller
array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0; array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0;
array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0; array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0;
$save = $this->repo->store($request, 'thumbnail', 'off');
$save = $this->repo->store($data);
if (webprofilesetting()['auto_translate'] == 1) { if (webprofilesetting()['auto_translate'] == 1) {
// save translate // save translate
...@@ -138,7 +137,7 @@ class PostController extends Controller ...@@ -138,7 +137,7 @@ class PostController extends Controller
array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0; array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0;
$post = $this->repo->findId($id, ['rEn']); $post = $this->repo->findId($id, ['rEn']);
$edit = $this->repo->update($data, $post); $edit = $this->repo->update($request, $post, 'thumbnail', 'off');
$this->updateEn($dataEn, $post); $this->updateEn($dataEn, $post);
...@@ -162,7 +161,7 @@ class PostController extends Controller ...@@ -162,7 +161,7 @@ class PostController extends Controller
public function destroy($id) public function destroy($id)
{ {
$data = $this->repo->findId($id, ['rEn']); $data = $this->repo->findId($id, ['rEn']);
$this->repo->destroy($data); $this->repo->destroy($data, 'thumbnail');
if ($data->rEn) { if ($data->rEn) {
$this->repoEn->destroy($data->rEn); $this->repoEn->destroy($data->rEn);
......
...@@ -36,7 +36,7 @@ abstract class StorageRepository ...@@ -36,7 +36,7 @@ abstract class StorageRepository
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store($request, $tipe) public function store($request, $tipe, $is_active = 'on')
{ {
$setting = webprofilesetting(); $setting = webprofilesetting();
...@@ -55,8 +55,11 @@ abstract class StorageRepository ...@@ -55,8 +55,11 @@ abstract class StorageRepository
$data[$tipe] = $filename; $data[$tipe] = $filename;
} }
if ($is_active == 'on') {
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0; array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
$request['userid_created'] = auth()->user()->id; }
$data['userid_created'] = auth()->user()->id;
return $this->model->create($data); return $this->model->create($data);
} }
...@@ -67,7 +70,7 @@ abstract class StorageRepository ...@@ -67,7 +70,7 @@ abstract class StorageRepository
* @param Model $model * @param Model $model
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update($request, $model, $tipe) public function update($request, $model, $tipe, $is_active = 'on')
{ {
$setting = webprofilesetting(); $setting = webprofilesetting();
...@@ -87,7 +90,9 @@ abstract class StorageRepository ...@@ -87,7 +90,9 @@ abstract class StorageRepository
$data[$tipe] = $filename; $data[$tipe] = $filename;
} }
if ($is_active == 'on') {
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0; array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
}
$data['userid_updated'] = auth()->user()->id; $data['userid_updated'] = auth()->user()->id;
return $model->update($data); return $model->update($data);
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
namespace App\Repositories\Webprofile; namespace App\Repositories\Webprofile;
use App\Models\Webprofile\Posts; use App\Models\Webprofile\Posts;
use App\Repositories\Repository; use App\Repositories\StorageRepository;
use DataTables; use DataTables;
class PostRepository extends Repository class PostRepository extends StorageRepository
{ {
protected $model; protected $model;
...@@ -30,18 +30,6 @@ class PostRepository extends Repository ...@@ -30,18 +30,6 @@ class PostRepository extends Repository
->get(); ->get();
} }
/**
* Custom Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store($request)
{
$request['userid_created'] = auth()->user()->id;
return $this->model->create($request);
}
public function datatable($data) public function datatable($data)
{ {
return DataTables::of($data) return DataTables::of($data)
......
...@@ -39,7 +39,13 @@ ...@@ -39,7 +39,13 @@
<div class="blog-carousel"> <div class="blog-carousel">
<div class="entry"> <div class="entry">
@if($value->thumbnail) @if($value->thumbnail)
<center><img src="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/{!! Session::get('ss_setting')['statik_konten'] !!}/posts/{!! $value->thumbnail !!}" alt="" class="img-responsive" style="height: 150px; width: auto;"></center> <center>
@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $value->thumbnail }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@else
<img src="{{ url('/storage/thumbnail/' . $value->thumbnail) }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@endif
</center>
@endif @endif
</div> </div>
<div class="blog-carousel-header"> <div class="blog-carousel-header">
...@@ -78,6 +84,18 @@ ...@@ -78,6 +84,18 @@
</div><!-- end content --> </div><!-- end content -->
<div id="sidebar" class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> <div id="sidebar" class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
{{-- <div class="widget">
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'id'
}, 'google_translate_element');
}
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</div> --}}
<div class="widget"> <div class="widget">
<div class="title"> <div class="title">
<h2>AGENDA</h2> <h2>AGENDA</h2>
...@@ -104,7 +122,15 @@ ...@@ -104,7 +122,15 @@
<ul class="recent_posts_widget"> <ul class="recent_posts_widget">
@foreach($resend as $value) @foreach($resend as $value)
<li> <li>
<a href="{!! url('post/'.$value->slug) !!}">@if($value->thumbnail)<img src="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/{!! Session::get('ss_setting')['statik_konten'] !!}/posts/{!! $value->thumbnail !!}" alt="" />@endif{!! $value->rEn->title !!}</a> <a href="{!! url('post/'.$value->slug) !!}">
@if($value->thumbnail)
@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $value->thumbnail }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@else
<img src="{{ url('/storage/thumbnail/' . $value->thumbnail) }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@endif
@endif{!! $value->rEn->title !!}
</a>
<a class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</a> <a class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</a>
</li> </li>
@endforeach @endforeach
...@@ -114,7 +140,12 @@ ...@@ -114,7 +140,12 @@
<ul class="recent_posts_widget"> <ul class="recent_posts_widget">
@foreach($hot as $value) @foreach($hot as $value)
<li> <li>
<a href="{!! url('post/'.$value->slug) !!}">@if($value->thumbnail)<img src="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/{!! Session::get('ss_setting')['statik_konten'] !!}/posts/{!! $value->thumbnail !!}" alt="" />@endif{!! $value->rEn->title !!}</a> <a href="{!! url('post/'.$value->slug) !!}">@if($value->thumbnail)@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $value->thumbnail }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@else
<img src="{{ url('/storage/thumbnail/' . $value->thumbnail) }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@endif
@endif{!! $value->rEn->title !!}</a>
<a class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</a> <a class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</a>
</li> </li>
@endforeach @endforeach
......
...@@ -39,7 +39,13 @@ ...@@ -39,7 +39,13 @@
<div class="blog-carousel"> <div class="blog-carousel">
<div class="entry"> <div class="entry">
@if($value->thumbnail) @if($value->thumbnail)
<center><img src="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/{!! Session::get('ss_setting')['statik_konten'] !!}/posts/{!! $value->thumbnail !!}" alt="" class="img-responsive" style="height: 150px; width: auto;"></center> <center>
@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $value->thumbnail }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@else
<img src="{{ url('/storage/thumbnail/' . $value->thumbnail) }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@endif
</center>
@endif @endif
</div> </div>
<div class="blog-carousel-header"> <div class="blog-carousel-header">
...@@ -78,6 +84,18 @@ ...@@ -78,6 +84,18 @@
</div><!-- end content --> </div><!-- end content -->
<div id="sidebar" class="col-lg-4 col-md-4 col-sm-12 col-xs-12"> <div id="sidebar" class="col-lg-4 col-md-4 col-sm-12 col-xs-12">
{{-- <div class="widget">
<div id="google_translate_element"></div>
<script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'id'
}, 'google_translate_element');
}
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
</div> --}}
<div class="widget"> <div class="widget">
<div class="title"> <div class="title">
<h2>AGENDA</h2> <h2>AGENDA</h2>
...@@ -104,8 +122,18 @@ ...@@ -104,8 +122,18 @@
<ul class="recent_posts_widget"> <ul class="recent_posts_widget">
@foreach($resend as $value) @foreach($resend as $value)
<li> <li>
<a href="{!! url('post/'.$value->slug) !!}">@if($value->thumbnail)<img src="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/{!! Session::get('ss_setting')['statik_konten'] !!}/posts/{!! $value->thumbnail !!}" alt="" />@endif{!! $value->title !!}</a> <a href="{!! url('post/'.$value->slug) !!}">
<a class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</a> @if($value->thumbnail)
@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $value->thumbnail }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@else
<img src="{{ url('/storage/thumbnail/' . $value->thumbnail) }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@endif
@endif{!! $value->title !!}
</a>
<a class="readmore" href="{!! url('post/'.$value->slug) !!}">
{!! InseoHelper::tglbulanindo2($value->post_date) !!}
</a>
</li> </li>
@endforeach @endforeach
</ul><!-- recent posts --> </ul><!-- recent posts -->
...@@ -114,7 +142,15 @@ ...@@ -114,7 +142,15 @@
<ul class="recent_posts_widget"> <ul class="recent_posts_widget">
@foreach($hot as $value) @foreach($hot as $value)
<li> <li>
<a href="{!! url('post/'.$value->slug) !!}">@if($value->thumbnail)<img src="https://statik.unesa.ac.id/profileunesa_konten_statik/uploads/{!! Session::get('ss_setting')['statik_konten'] !!}/posts/{!! $value->thumbnail !!}" alt="" />@endif{!! $value->title !!}</a> <a href="{!! url('post/'.$value->slug) !!}">
@if($value->thumbnail)
@if ($setting['external_storage'] == 1)
<img src="{{ $setting['url_static'] . '/' . $setting['directory'] . '/thumbnail/' . $value->thumbnail }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@else
<img src="{{ url('/storage/thumbnail/' . $value->thumbnail) }}" alt="" class="img-responsive" style="height: 150px; width: auto;">
@endif
@endif{!! $value->title !!}
</a>
<a class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</a> <a class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</a>
</li> </li>
@endforeach @endforeach
......
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