Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6ae53bba4 | ||
|
|
7c0f6298da | ||
|
|
98d9dc2ad8 | ||
|
|
36ff41a474 |
No files matched your search
@@ -0,0 +1,20 @@
|
|||||||
|
## How to install
|
||||||
|
1. Install the package `composer require mathiaspalmqvist/laravel-cision-feed`
|
||||||
|
2. add the cision company slug to `LARAVEL_CISION_FEED_SLUG` at your env
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
`LaravelCisionFeed::all();`
|
||||||
|
Returns everyting from the feed.
|
||||||
|
|
||||||
|
`LaravelCisionFeed::press();`
|
||||||
|
Returns all press releases from the feed.
|
||||||
|
|
||||||
|
`LaravelCisionFeed::financial();`
|
||||||
|
Returns all financial reports from the feed.
|
||||||
|
|
||||||
|
`LaravelCisionFeed::news();`
|
||||||
|
Returns all news from the feed.
|
||||||
|
|
||||||
|
`LaravelCisionFeed::media();`
|
||||||
|
Returns all media from the feed.
|
||||||
@@ -19,7 +19,7 @@ class LaravelCisionFeed
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::parse($request->body());
|
return self::parse($request->body(), $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,9 +108,10 @@ class LaravelCisionFeed
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|null $data
|
* @param string|null $data
|
||||||
* @return array|false
|
* @param int $page
|
||||||
|
* @return bool|array
|
||||||
*/
|
*/
|
||||||
private static function parse(string $data = null): bool|array
|
private static function parse(string $data = null, int $page = 1): bool|array
|
||||||
{
|
{
|
||||||
if ($data === null) {
|
if ($data === null) {
|
||||||
return false;
|
return false;
|
||||||
@@ -127,7 +128,7 @@ class LaravelCisionFeed
|
|||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
foreach ($rows['channel']['item'] as $row) {
|
foreach ($rows['channel']['item'] as $row) {
|
||||||
$return[] = [
|
$return['items'][] = [
|
||||||
'guid' => $row['guid'],
|
'guid' => $row['guid'],
|
||||||
'title' => $row['title'],
|
'title' => $row['title'],
|
||||||
'description' => $row['description'],
|
'description' => $row['description'],
|
||||||
@@ -136,6 +137,9 @@ class LaravelCisionFeed
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$return['previous_page'] = $page > 1 ? $page-- : false;
|
||||||
|
$return['next_page'] = count( $rows['channel']['item'] ) === 24 ? ++$page : false;
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user