ProductAttribute.php 686 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Shop\ProductAttributes;
  3. use App\Shop\AttributeValues\AttributeValue;
  4. use App\Shop\Products\Product;
  5. use Illuminate\Database\Eloquent\Model;
  6. class ProductAttribute extends Model
  7. {
  8. protected $fillable = [
  9. 'quantity',
  10. 'price',
  11. 'sale_price',
  12. 'default'
  13. ];
  14. /**
  15. * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
  16. */
  17. public function product()
  18. {
  19. return $this->belongsTo(Product::class);
  20. }
  21. /**
  22. * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
  23. */
  24. public function attributesValues()
  25. {
  26. return $this->belongsToMany(AttributeValue::class);
  27. }
  28. }