Add RSS of Announcements feed to Dashboard page
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Flash;
|
||||
use Response;
|
||||
use Feed;
|
||||
|
||||
|
||||
class DashboardController extends BaseController
|
||||
{
|
||||
@@ -13,6 +13,12 @@ class DashboardController extends BaseController
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('admin.dashboard');
|
||||
Feed::$cacheDir = storage_path();
|
||||
Feed::$cacheExpire = '5 hours';
|
||||
|
||||
$feed = Feed::loadRss(config('phpvms.feed_url'));
|
||||
return view('admin.dashboard', [
|
||||
'feed' => $feed,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
"webpatser/laravel-uuid": "^2.0",
|
||||
"chrisbjr/api-guard": "^4.0",
|
||||
"spatie/laravel-fractal": "^4.01",
|
||||
"composer/semver": "^1.4"
|
||||
"composer/semver": "^1.4",
|
||||
"dg/rss-php": "^1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
|
||||
44
composer.lock
generated
44
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "b3b902af0d22fe654922a05444feedb8",
|
||||
"content-hash": "2ab8f5fa4fb05e2eddd93396aadd3f94",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anlutro/l4-settings",
|
||||
@@ -288,6 +288,48 @@
|
||||
],
|
||||
"time": "2016-08-30T16:08:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dg/rss-php",
|
||||
"version": "v1.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dg/rss-php.git",
|
||||
"reference": "b33661748d89d8c0c288e8d86feada6018d05031"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/dg/rss-php/zipball/b33661748d89d8c0c288e8d86feada6018d05031",
|
||||
"reference": "b33661748d89d8c0c288e8d86feada6018d05031",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.2.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "David Grudl",
|
||||
"homepage": "http://davidgrudl.com"
|
||||
}
|
||||
],
|
||||
"description": "RSS & Atom Feeds for PHP is a very small and easy-to-use library for consuming an RSS and Atom feed",
|
||||
"homepage": "https://github.com/dg/rss-php",
|
||||
"keywords": [
|
||||
"atom",
|
||||
"feed",
|
||||
"rss"
|
||||
],
|
||||
"time": "2015-07-02T11:54:05+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/annotations",
|
||||
"version": "v1.4.0",
|
||||
|
||||
@@ -78,6 +78,7 @@ return [
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Carbon' => \Carbon\Carbon::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
|
||||
@@ -25,4 +25,10 @@ return [
|
||||
*/
|
||||
'currency' => 'dollar',
|
||||
|
||||
/**
|
||||
* Misc Settings
|
||||
*/
|
||||
|
||||
'feed_url' => 'http://forum.phpvms.net/rss/1-announcements-feed.xml/?',
|
||||
|
||||
];
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/chrisbjr/api-guard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/dg/rss-php" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ellipsesynergie/api-response" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
|
||||
@@ -38,6 +39,7 @@
|
||||
<CLASSES>
|
||||
<root url="file://$APPLICATION_HOME_DIR$/bin" />
|
||||
<root url="file://$MODULE_DIR$/vendor/chrisbjr/api-guard" />
|
||||
<root url="file://$MODULE_DIR$/vendor/dg/rss-php" />
|
||||
<root url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
|
||||
<root url="file://$MODULE_DIR$/vendor/ellipsesynergie/api-response" />
|
||||
<root url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
|
||||
@@ -59,6 +61,7 @@
|
||||
<SOURCES>
|
||||
<root url="file://$APPLICATION_HOME_DIR$/bin" />
|
||||
<root url="file://$MODULE_DIR$/vendor/chrisbjr/api-guard" />
|
||||
<root url="file://$MODULE_DIR$/vendor/dg/rss-php" />
|
||||
<root url="file://$MODULE_DIR$/vendor/dompdf/dompdf" />
|
||||
<root url="file://$MODULE_DIR$/vendor/ellipsesynergie/api-response" />
|
||||
<root url="file://$MODULE_DIR$/vendor/jeremeamia/SuperClosure" />
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
@extends('admin.app')
|
||||
|
||||
@section('content')
|
||||
<section class="content-header">
|
||||
<h1 class="pull-left">Dashboard</h1>
|
||||
</section>
|
||||
<section class="content-header"></section>
|
||||
<div class="content">
|
||||
<div class="clearfix"></div>
|
||||
|
||||
@@ -29,6 +27,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="col-sm-12">
|
||||
<h3>announcements</h3>
|
||||
@foreach($feed->item as $item)
|
||||
<div>
|
||||
<strong>{!! $item->title !!}</strong>
|
||||
<p>{!! $item->description !!}</p>
|
||||
<p class="pull-right">{!! Carbon::now()->diffForHumans(new Carbon($item->pubDate), true) !!}</p>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user