Files
YNWA Fawzy b374a27f94 Enhancements:
- bump packages versions.
- add product image and product link to feed.
- Move the rss to notification instead of tempalte
- new product list layout ( still in work)

Fixes:
- fix authentication not required.
- add docker link to README.md
- update discord link
- clear cache when new store is added for a product

In Progress:
- walmart might not work properly as i am still working on it

Took 4 hours 50 minutes
2024-12-04 19:32:15 +04:00

44 lines
893 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Feed\Feedable;
use Spatie\Feed\FeedItem;
class RssFeedItem extends Model implements Feedable
{
use HasFactory;
protected $fillable=[
"data"
];
protected function casts(): array
{
return [
'data'=>'json'
];
}
public function toFeedItem(): FeedItem
{
return FeedItem::create([
"id"=>$this->id,
'title' => $this->data["title"],
'summary' => $this->data["summary"],
'updated' => now(),
'link' => $this->data['link'],
'image' => $this->data['image'],
'authorName' => "Discount Bandit",
]);
}
public static function getFeedItems()
{
return RssFeedItem::all();
}
}