Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 self::parse($request->body());
|
||||
return self::parse($request->body(), $page);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +41,7 @@ class LaravelCisionFeed
|
||||
* @param int $page
|
||||
* @return array|false
|
||||
*/
|
||||
public static function financial(int $page = 1): bool|array
|
||||
public static function financial(int $page = 1): bool|array
|
||||
{
|
||||
$request = self::request($page, 'Financial');
|
||||
|
||||
@@ -108,9 +108,10 @@ class LaravelCisionFeed
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
return false;
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user