Merge pull request #50 from cachethq/rss-feed
Adds RSS feed. Closes #26. No link or anything, but accessible at /rss
This commit is contained in:
@@ -125,7 +125,7 @@ return array(
|
|||||||
'Dingo\Api\Provider\ApiServiceProvider',
|
'Dingo\Api\Provider\ApiServiceProvider',
|
||||||
|
|
||||||
'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider',
|
'CachetHQ\Cachet\Support\ServiceProviders\RepositoryServiceProvider',
|
||||||
|
'Thujohn\Rss\RssServiceProvider',
|
||||||
),
|
),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -194,7 +194,8 @@ return array(
|
|||||||
'Validator' => 'Illuminate\Support\Facades\Validator',
|
'Validator' => 'Illuminate\Support\Facades\Validator',
|
||||||
'View' => 'Illuminate\Support\Facades\View',
|
'View' => 'Illuminate\Support\Facades\View',
|
||||||
|
|
||||||
'API' => 'Dingo\Api\Facades\API'
|
'API' => 'Dingo\Api\Facades\API',
|
||||||
|
'RSS' => 'Thujohn\Rss\RssFacade',
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
27
app/controllers/RSSController.php
Normal file
27
app/controllers/RSSController.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class RSSController extends Controller {
|
||||||
|
public function feedAction() {
|
||||||
|
$feed = RSS::feed('2.0', 'UTF-8');
|
||||||
|
$feed->channel([
|
||||||
|
'title' => Setting::get('app_name'),
|
||||||
|
'description' => 'Status Feed',
|
||||||
|
'link' => Setting::get('app_domain'),
|
||||||
|
]);
|
||||||
|
|
||||||
|
Incident::get()->map(function($incident) use ($feed) {
|
||||||
|
$feed->item([
|
||||||
|
'title' => $incident->name,
|
||||||
|
'message' => $incident->message,
|
||||||
|
'component' => $incident->parent->name,
|
||||||
|
'status' => $incident->humanStatus,
|
||||||
|
'created_at' => $incident->created_at,
|
||||||
|
'updated_at' => $incident->updated_at
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
return Response::make($feed, 200, [
|
||||||
|
'Content-Type' => 'text/xml'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
protected $fillable = ['component', 'name', 'status', 'message'];
|
protected $fillable = ['component', 'name', 'status', 'message'];
|
||||||
|
|
||||||
|
protected $appends = ['humanStatus'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An incident belongs to a component.
|
* An incident belongs to a component.
|
||||||
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||||
@@ -29,7 +31,8 @@
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getHumanStatusAttribute() {
|
public function getHumanStatusAttribute() {
|
||||||
return Lang::get('incident.status' . $this->status);
|
$statuses = Lang::get('incident.status');
|
||||||
|
return $statuses[$this->status];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,3 +20,5 @@
|
|||||||
// Authorization stuff.
|
// Authorization stuff.
|
||||||
Route::get('/auth/logout', 'AuthController@logoutAction');
|
Route::get('/auth/logout', 'AuthController@logoutAction');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::get('/rss', 'RSSController@feedAction');
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"laravel/framework": "4.2.*",
|
"laravel/framework": "4.2.*",
|
||||||
"guzzlehttp/guzzle": "~5.0",
|
"guzzlehttp/guzzle": "~5.0",
|
||||||
"dingo/api": "0.7.*",
|
"dingo/api": "0.7.*",
|
||||||
"watson/validating": "0.10.*"
|
"watson/validating": "0.10.*",
|
||||||
|
"thujohn/rss": "dev-master"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "~4.3.0"
|
"phpunit/phpunit": "~4.3.0"
|
||||||
|
|||||||
48
composer.lock
generated
48
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "0f6a2d4a8afd20da1db9127e18b3b358",
|
"hash": "62ab8c6b87bf3b5342d449b46df2d76b",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "classpreloader/classpreloader",
|
"name": "classpreloader/classpreloader",
|
||||||
@@ -1961,6 +1961,48 @@
|
|||||||
"homepage": "http://symfony.com",
|
"homepage": "http://symfony.com",
|
||||||
"time": "2014-10-26 07:41:27"
|
"time": "2014-10-26 07:41:27"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "thujohn/rss",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/thujohn/rss-l4.git",
|
||||||
|
"reference": "8c03400062167c3f6b7340a1c964cdb3626a4e4b"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/thujohn/rss-l4/zipball/8c03400062167c3f6b7340a1c964cdb3626a4e4b",
|
||||||
|
"reference": "8c03400062167c3f6b7340a1c964cdb3626a4e4b",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"illuminate/support": "4.x",
|
||||||
|
"php": ">=5.3.0"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-0": {
|
||||||
|
"Thujohn\\Rss": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Jonathan Thuau",
|
||||||
|
"email": "jonathan.thuau@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "RSS builder for Laravel 4",
|
||||||
|
"keywords": [
|
||||||
|
"laravel",
|
||||||
|
"laravel4",
|
||||||
|
"rss"
|
||||||
|
],
|
||||||
|
"time": "2014-04-07 20:15:45"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "watson/validating",
|
"name": "watson/validating",
|
||||||
"version": "0.10.6",
|
"version": "0.10.6",
|
||||||
@@ -2758,7 +2800,9 @@
|
|||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": [],
|
"stability-flags": {
|
||||||
|
"thujohn/rss": 20
|
||||||
|
},
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"platform": [],
|
"platform": [],
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
|
|||||||
Reference in New Issue
Block a user