mirror of
https://github.com/Cybrarist/Discount-Bandit.git
synced 2026-11-24 19:49:54 +01:00
- 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
44 lines
893 B
PHP
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();
|
|
}
|
|
|
|
}
|