Update packages. Add docker support, move migration to command, add stocks as a new table.
This commit is contained in:
@@ -29,6 +29,10 @@ class Product extends Model
|
||||
{
|
||||
return $this->hasMany(Price::class);
|
||||
}
|
||||
public function stock(): HasMany
|
||||
{
|
||||
return $this->hasMany(Stock::class);
|
||||
}
|
||||
|
||||
public function toggleStarred(): self
|
||||
{
|
||||
@@ -42,5 +46,4 @@ class Product extends Model
|
||||
get: fn(string $value) => array_reverse(json_decode($value, 1)),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
25
src/Models/Stock.php
Normal file
25
src/Models/Stock.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Krzysiej\RyobiCrawler\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property integer $availableQuantity
|
||||
* @property integer $stock
|
||||
* @property boolean $isInStock
|
||||
* @property boolean $previouslyHadStock
|
||||
* @property boolean $isNew
|
||||
* @property boolean $isComingSoon
|
||||
* @property boolean $isOnSale
|
||||
*/
|
||||
class Stock extends Model
|
||||
{
|
||||
public $timestamps = true;
|
||||
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user