Add Minoos support

This commit is contained in:
Mohamed jinas
2024-01-12 04:34:28 +05:00
parent fbaa43748f
commit 46e2e849bb
5 changed files with 194 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
<?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;
}
}