StoreItemVariation.php 597 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\Relations\BelongsTo;
  5. class StoreItemVariation extends Model
  6. {
  7. protected $fillable = [
  8. 'store_item_id',
  9. 'variation_type',
  10. 'variation_label',
  11. 'variation_value',
  12. 'stock',
  13. ];
  14. protected function casts(): array
  15. {
  16. return [
  17. 'variation_value' => 'float',
  18. 'stock' => 'integer',
  19. ];
  20. }
  21. public function storeItem(): BelongsTo
  22. {
  23. return $this->belongsTo(StoreItem::class);
  24. }
  25. }