Added a way to starr a product, so it floats on top of the list of products
This commit is contained in:
@@ -18,6 +18,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
* @property string $variantCode
|
||||
* @property string $modelCode
|
||||
* @property string $url
|
||||
* @property boolean $starred
|
||||
*/
|
||||
class Product extends Model
|
||||
{
|
||||
@@ -29,6 +30,12 @@ class Product extends Model
|
||||
return $this->hasMany(Price::class);
|
||||
}
|
||||
|
||||
public function toggleStarred(): self
|
||||
{
|
||||
$this->starred = !$this->starred;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function categories(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
|
||||
Reference in New Issue
Block a user