show front image

parent 46465ada
......@@ -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('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0;
$save = $this->repo->store($data);
$save = $this->repo->store($request, 'thumbnail', 'off');
if (webprofilesetting()['auto_translate'] == 1) {
// save translate
......@@ -138,7 +137,7 @@ class PostController extends Controller
array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0;
$post = $this->repo->findId($id, ['rEn']);
$edit = $this->repo->update($data, $post);
$edit = $this->repo->update($request, $post, 'thumbnail', 'off');
$this->updateEn($dataEn, $post);
......@@ -162,7 +161,7 @@ class PostController extends Controller
public function destroy($id)
{
$data = $this->repo->findId($id, ['rEn']);
$this->repo->destroy($data);
$this->repo->destroy($data, 'thumbnail');
if ($data->rEn) {
$this->repoEn->destroy($data->rEn);
......
......@@ -36,7 +36,7 @@ abstract class StorageRepository
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store($request, $tipe)
public function store($request, $tipe, $is_active = 'on')
{
$setting = webprofilesetting();
......@@ -55,8 +55,11 @@ abstract class StorageRepository
$data[$tipe] = $filename;
}
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
$request['userid_created'] = auth()->user()->id;
if ($is_active == 'on') {
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
}
$data['userid_created'] = auth()->user()->id;
return $this->model->create($data);
}
......@@ -67,7 +70,7 @@ abstract class StorageRepository
* @param Model $model
* @return \Illuminate\Http\Response
*/
public function update($request, $model, $tipe)
public function update($request, $model, $tipe, $is_active = 'on')
{
$setting = webprofilesetting();
......@@ -87,7 +90,9 @@ abstract class StorageRepository
$data[$tipe] = $filename;
}
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
if ($is_active == 'on') {
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
}
$data['userid_updated'] = auth()->user()->id;
return $model->update($data);
......
......@@ -3,10 +3,10 @@
namespace App\Repositories\Webprofile;
use App\Models\Webprofile\Posts;
use App\Repositories\Repository;
use App\Repositories\StorageRepository;
use DataTables;
class PostRepository extends Repository
class PostRepository extends StorageRepository
{
protected $model;
......@@ -30,18 +30,6 @@ class PostRepository extends Repository
->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)
{
return DataTables::of($data)
......
......@@ -39,7 +39,13 @@
<div class="blog-carousel">
<div class="entry">
@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
</div>
<div class="blog-carousel-header">
......@@ -78,6 +84,18 @@
</div><!-- end content -->
<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="title">
<h2>AGENDA</h2>
......@@ -104,7 +122,15 @@
<ul class="recent_posts_widget">
@foreach($resend as $value)
<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>
</li>
@endforeach
......@@ -114,7 +140,12 @@
<ul class="recent_posts_widget">
@foreach($hot as $value)
<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>
</li>
@endforeach
......
......@@ -39,7 +39,13 @@
<div class="blog-carousel">
<div class="entry">
@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
</div>
<div class="blog-carousel-header">
......@@ -78,6 +84,18 @@
</div><!-- end content -->
<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="title">
<h2>AGENDA</h2>
......@@ -104,8 +122,18 @@
<ul class="recent_posts_widget">
@foreach($resend as $value)
<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 class="readmore" href="{!! url('post/'.$value->slug) !!}">{!! InseoHelper::tglbulanindo2($value->post_date) !!}</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>
</li>
@endforeach
</ul><!-- recent posts -->
......@@ -114,7 +142,15 @@
<ul class="recent_posts_widget">
@foreach($hot as $value)
<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>
</li>
@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