Add price and product models

This commit is contained in:
Krzysztof Płaczek
2024-03-26 12:42:06 +01:00
parent 5dc1c9d9f0
commit b4536e4c6b
6 changed files with 100 additions and 36 deletions

21
src/Models/Price.php Normal file
View File

@@ -0,0 +1,21 @@
<?php
namespace Krzysiej\RyobiCrawler\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* @property float $price
* @property float $productStandardPrice
* @property float $lowestProductPrice30Days
*/
class Price extends Model
{
public $timestamps = true;
public function product(): BelongsTo
{
return $this->belongsTo(Product::class);
}
}

29
src/Models/Product.php Normal file
View File

@@ -0,0 +1,29 @@
<?php
namespace Krzysiej\RyobiCrawler\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* @property integer $skuID
* @property integer $agilityID
* @property string $name
* @property integer $availableQuantity
* @property integer $stock
* @property string[] $categories
* @property string $image
* @property string $subTitle
* @property string $variantCode
* @property string $modelCode
* @property string $url
*/
class Product extends Model
{
public $timestamps = true;
public $fillable = ['skuID'];
public function price(): HasMany
{
return $this->hasMany(Price::class);
}
}