Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 2 additions & 35 deletions app/Http/Controllers/FrontEnd/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@
use App\Models\Event;
use App\Models\Artikel;
use App\Facades\Counter;
use App\Models\DataDesa;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use SimplePie;
use App\Http\Controllers\FrontEndController;
use App\Http\Requests\SurveiRequest;
use App\Models\Kategori;
Expand Down Expand Up @@ -82,38 +79,8 @@ public function beritaDesa()
}

private function getFeeds()
{
$all_desa = DataDesa::websiteUrl()->get()
->map(function ($desa) {
return $desa->website_url_feed;
})->all();

$feeds = [];
foreach ($all_desa as $desa) {
$getFeeds = new SimplePie();
$getFeeds->set_feed_url($desa['website']);
$getFeeds->set_item_limit(5);
$getFeeds->force_fsockopen(true);
$getFeeds->set_cache_location(storage_path('framework/cache/simplepie'));
$getFeeds->init();
$getFeeds->handle_content_type();
foreach ($getFeeds->get_items() as $item) {
$feeds[] = [
'desa_id' => $desa['desa_id'],
'nama_desa' => $desa['nama'],
'feed_link' => $item->get_feed()->get_permalink(),
'feed_title' => $item->get_feed()->get_title(),
'link' => $item->get_link(),
'date' => \Carbon\Carbon::parse($item->get_date('U')),
'author' => $item->get_author()->get_name() ?? 'Administrator',
'title' => $item->get_title(),
'image' => get_tag_image($item->get_description()),
'description' => strip_tags(substr(str_replace(['&', 'nbsp;', '[...]'], '', $item->get_description()), 0, 250) . '[...]'),
'content' => $item->get_content(),
];
}
}

{
$feeds = (new DesaService())->getFeeds();
return $feeds ?? null;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Services/DesaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function getFeeds(): array
foreach ($allDesa as $desa) {
$feedReader = new SimplePie();
$feedReader->set_feed_url($desa->website_url_feed['website']);
$feedReader->set_item_limit(5);
//$feedReader->set_item_limit(5);
$feedReader->force_fsockopen(true);
$feedReader->set_cache_location(storage_path('framework/cache/simplepie'));
$feedReader->init();
Expand Down
35 changes: 14 additions & 21 deletions themes/opendk/default/resources/views/pages/berita/desa.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,20 @@
<strong>Berita
{{ config('setting.sebutan_desa') }}</strong>
</div>
<form class="form-horizontal" id="form_filter" method="get" action="{{ route('filter-berita-desa') }}">
<input type="hidden" value="1" name="page">
<div class="page-header" style="margin:0px 0px;">
<strong>Berita
{{ config('setting.sebutan_desa') }}</strong>
</div>
<div class="page-header" style="margin:0px 0px; padding: 0px;">
<div class="row page-header-row">
<div class="col-md-8 page-header-left">
@include('layouts.fragments.select-desa')
<select class="form-control select2" id="tanggal" name="tanggal">
<option value="Terlama">Terbaru</option>
<option value="Terbaru">Terlama</option>
</select>
</div>
<div class="col-md-4">
<div class="input-group input-group-sm" style="display: inline-flex; float: right; padding: 5px;">
<input class="form-control" type="text" name="cari" placeholder="Cari berita" value="{{ $cari }}" style="height: auto;" />
<div class="input-group-append">
<button type="submit" class="btn btn-info"><i class="fa fa-search"></i></button>
</div>
<div class="page-header" style="margin:0px 0px; padding: 0px;">
<div class="row page-header-row">
<div class="col-md-8 page-header-left">
@include('layouts.fragments.select-desa')
<select class="form-control select2" id="tanggal" name="tanggal">
<option value="Terlama">Terbaru</option>
<option value="Terbaru">Terlama</option>
</select>
</div>
<div class="col-md-4">
<div class="input-group input-group-sm" style="display: inline-flex; float: right; padding: 5px;">
<input class="form-control" type="text" name="cari" placeholder="Cari berita" value="{{ $cari }}" style="height: auto;" />
<div class="input-group-append">
<button type="submit" class="btn btn-info"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
event.preventDefault();
}

$('#list_desa').attr('name', 'desa')
$('#list_desa').attr('name','desa')
$("#list_desa").change(function() {
$("#form_filter").submit();
});
Expand Down
Loading