Laatste nieuws balk
This commit is contained in:
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
private $API_URL;
|
||||
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
@@ -24,6 +27,20 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$this->API_URL = env('API_URL', 'http://api.6fm.nl/');
|
||||
|
||||
// Update latest news (3 items)
|
||||
$schedule->call(function() {
|
||||
$latest_news = json_decode(file_get_contents($this->API_URL . 'nieuws/overzicht?pagina=1&aantal=3'));
|
||||
|
||||
$news = [];
|
||||
foreach($latest_news->news as $item_data)
|
||||
{
|
||||
$news[] = new \Model\NewsItem($item_data);
|
||||
}
|
||||
|
||||
Storage::disk('local')->put('laatste_nieuws.json', json_encode($news));
|
||||
})->everyMinute();
|
||||
// $schedule->command('inspire')
|
||||
// ->hourly();
|
||||
}
|
||||
|
||||
10
website/public/css/nhgooi.css
vendored
10
website/public/css/nhgooi.css
vendored
@@ -59,6 +59,16 @@ button[disabled]:hover
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.posted_by abbr.when
|
||||
{
|
||||
float: right;
|
||||
color: #7C7C7C;
|
||||
font-size: 12px;
|
||||
margin-top: 7px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
.blog_grid .post img {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -249,31 +249,7 @@
|
||||
</a>
|
||||
</li>-->
|
||||
</ul>
|
||||
<div class="latest_news_scrolling_list_container">
|
||||
<ul>
|
||||
<li class="category">Laatste nieuws:</li>
|
||||
<li class="left"><a href="#"></a></li>
|
||||
<li class="right"><a href="#"></a></li>
|
||||
<li class="posts">
|
||||
<ul class="latest_news_scrolling_list">
|
||||
<li>
|
||||
<a href="?page=post" title="">Climate Change Debate While Britain Floods</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="?page=post" title="">The Public Health Crisis Hiding in Our Food</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="?page=post" title="">Nuclear Fusion Closer to Becoming a Reality</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="date">
|
||||
<abbr title="04 Apr 2014" class="timeago current">04 Apr 2014</abbr>
|
||||
<abbr title="04 May 2014" class="timeago">04 May 2014</abbr>
|
||||
<abbr title="04 June 2014" class="timeago">04 June 2014</abbr>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@include('widgets/laatstenieuws')
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
|
||||
32
website/resources/views/widgets/laatstenieuws.blade.php
Normal file
32
website/resources/views/widgets/laatstenieuws.blade.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
$latest_news = json_decode(file_get_contents('http://api-dev.6fm.nl/nieuws/overzicht?pagina=1&aantal=3'))->news;
|
||||
|
||||
$news = [];
|
||||
foreach($latest_news as $raw)
|
||||
{
|
||||
$news[] = new \Model\NewsItem($raw);
|
||||
}
|
||||
Storage::disk('local')->put('laatste_nieuws.json', json_encode($news));
|
||||
*/
|
||||
|
||||
$latest_news = json_decode(Storage::disk('local')->get('laatste_nieuws.json'));
|
||||
?>
|
||||
|
||||
<div class="latest_news_scrolling_list_container">
|
||||
<ul>
|
||||
<li class="category">Laatste nieuws:</li>
|
||||
<li class="left"><a href="#"></a></li>
|
||||
<li class="right"><a href="#"></a></li>
|
||||
<li class="posts">
|
||||
<ul class="latest_news_scrolling_list">
|
||||
@foreach($item as $latest_news)
|
||||
<li>
|
||||
<a href="{{url($item->url)}}" title="{{$item->title}}">{{$item->title}}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user