diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index f5a76b5f..5b954e3d 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -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, + ]); } } diff --git a/composer.json b/composer.json index 856d0fdd..71339603 100755 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/composer.lock b/composer.lock index 0048fb70..af246652 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/config/app.php b/config/app.php index cd0c45b8..cbf29075 100755 --- a/config/app.php +++ b/config/app.php @@ -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, diff --git a/config/phpvms.php b/config/phpvms.php index 8bb7f39d..4a4a2df3 100644 --- a/config/phpvms.php +++ b/config/phpvms.php @@ -25,4 +25,10 @@ return [ */ 'currency' => 'dollar', + /** + * Misc Settings + */ + + 'feed_url' => 'http://forum.phpvms.net/rss/1-announcements-feed.xml/?', + ]; diff --git a/phpvms.iml b/phpvms.iml index 68160d53..70df69dc 100644 --- a/phpvms.iml +++ b/phpvms.iml @@ -4,6 +4,7 @@ + @@ -38,6 +39,7 @@ + @@ -59,6 +61,7 @@ + diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php index b46773a9..3ab88b09 100644 --- a/resources/views/admin/dashboard.blade.php +++ b/resources/views/admin/dashboard.blade.php @@ -1,9 +1,7 @@ @extends('admin.app') @section('content') -
-

Dashboard

-
+
@@ -29,6 +27,22 @@
+ +
+
+
+

announcements

+ @foreach($feed->item as $item) +
+ {!! $item->title !!} +

{!! $item->description !!}

+

{!! Carbon::now()->diffForHumans(new Carbon($item->pubDate), true) !!}

+
+
+ @endforeach +
+
+
@endsection