Files
karudhaas/app/Services/Feeds/MinoosFeed.php
2024-01-12 04:34:28 +05:00

39 lines
835 B
PHP

<?php
namespace App\Services\Feeds;
use GuzzleHttp\Client;
class MinoosFeed implements Feed
{
protected $client;
public function __construct()
{
$this->client = new Client();
}
/**
* Get all the latest news
*
* @return array
*/
public function get() : array
{
$response = $this->client->request('GET', "https://fili.minoos.mv/api/category/news/posts");
$data = json_decode($response->getBody(), true);
$feeds = [];
foreach ($data['data'] as $item) {
$feeds[] = [
"title" => $item['heading'],
"link" => "https://minoos.mv/" . $item['id'],
"date" => $item['published_at'],
"highlights" => $item['highlights'],
];
}
return $feeds;
}
}